Beispiel #1
0
 def setUpTestData(cls):
     """
     Creates object requirements.
     """
     cls.user = create_user()
     cls.task = Task.objects.create(  # pylint: disable=E1101
         name="Task 1", created_by=cls.user)
Beispiel #2
0
 def setUpTestData(cls):
     """
     Sets up required objects like creating a test user and a poker_game object.
     """
     cls.user = create_user()
     cls.poker_game = PokerGame.objects.create(  # pylint: disable=E1101
         name='PokerGame 1', created_by=cls.user)
Beispiel #3
0
 def setUpTestData(cls):
     """
     Sets up required objects like creating a test user and a task object.
     """
     cls.user = create_user()
     cls.task = Task.objects.create(  # pylint: disable=E1101
         name='Task 1', created_by=cls.user)
 def test_create_user(self):
     """
     Creates object requirements.
     """
     user = create_user()
     self.assertIsInstance(user, User)
     self.assertEqual(User.objects.count(), 1)
     self.assertEqual(user.username, 'testuser')
     self.assertTrue(user.check_password('testpass'))
Beispiel #5
0
    def test_create_task(self):
        """
        Verifies that the user instance is assigned to created_by field from
        the created Task model instance.
        """
        user = create_user()

        task_form = TaskForm(user=user, data={'name': 'Task name 1'})
        self.assertEqual(task_form.user, user)
        self.assertTrue(task_form.is_valid())

        task = task_form.save()
        self.assertEqual(task.created_by, user)
Beispiel #6
0
    def test_create_vote(self):
        """
        Verifies that the user instance, and the task_id were assigned to
        correctly to the Vote model instance.
        """
        user = create_user()
        task = Task.objects.create(created_by=user, name='Task name 1')  # pylint: disable=E1101
        # Picking up the first value from Planning cards values tuple.
        value = PLANNING_CARDS[0][0]

        vote_form = VoteForm(user=user, task_id=task.id, data={'value': value})
        self.assertEqual(vote_form.user, user)
        self.assertEqual(vote_form.task_id, task.id)
        self.assertTrue(vote_form.is_valid())

        vote = vote_form.save()
        self.assertEqual(vote.user, user)
        self.assertEqual(vote.task, task)
        self.assertEqual(vote.value, value)
Beispiel #7
0
 def setUpTestData(cls):
     """
     Creates object requirements.
     """
     cls.user = create_user()
Beispiel #8
0
 def setUpTestData(cls):
     """Sets up required objects like creating a test user."""
     cls.user = create_user()