Exemplo n.º 1
0
    def test_profile_exists(self):
        """Test that profile page exists"""
        profile = create_profile()
        res = self.client.get(reverse('admin:app_profile_change', args=[profile.id]))

        self.assertEquals(res.status_code, status.HTTP_200_OK)
        self.assertContains(res, str(profile))
Exemplo n.º 2
0
    def test_post_exists(self):
        """Test that post page exists"""
        profile = create_profile()
        post = create_post(Post.Status.SUCCESS, profile, 'Test')
        res = self.client.get(reverse('admin:app_post_change', args=[post.id]))

        self.assertEquals(res.status_code, status.HTTP_200_OK)
        self.assertContains(res, str(post))
Exemplo n.º 3
0
    def test_start_sum(self):
        """Test that start_sum + distance = sum_distance"""
        profile = create_profile()
        post = create_post(Post.Status.SUCCESS, profile, text='5+15=20')
        self.assertEquals(post.start_sum, 5)

        post.distance = 10
        post.sum_distance = 50
        self.assertEquals(post.start_sum, 40)
Exemplo n.º 4
0
 def test_post_str(self):
     profile = create_profile()
     post = create_post(Post.Status.SUCCESS, profile, text='3+3', number=1)
     self.assertEquals(str(post),
                       f'Post(id: {post.id}, number: 1, text: 3+3)')
Exemplo n.º 5
0
 def setUp(self):
     self.profile = create_profile()