31 lines
844 B
Python
31 lines
844 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from django.test import TestCase
|
|
from django.test.client import Client
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
from secretquestions.models import Question
|
|
|
|
|
|
class SecretQuestionTest(TestCase):
|
|
|
|
client = Client()
|
|
username = 'paul'
|
|
password = 'lemay'
|
|
|
|
def setUp(self):
|
|
self.create_user()
|
|
self.create_questions()
|
|
|
|
def create_user(self):
|
|
self.user = User.objects.create(username=self.username)
|
|
self.user.set_password(self.password)
|
|
self.user.save()
|
|
|
|
def create_questions(self):
|
|
self.question1 = Question.objects.create(text="question1")
|
|
self.question2 = Question.objects.create(text="question2")
|
|
self.question3 = Question.objects.create(text="question3")
|
|
self.questions = (self.question1, self.question2, self.question3)
|