Commit f9504c73ba83a2dd6c8c56a3ed2366644c3a81a8
1 parent
af0afca2
Exists in
master
and in
5 other branches
[Issue #100]
Showing
1 changed file
with
8 additions
and
8 deletions
Show diff stats
forum/tests/test_model_forum.py
@@ -77,6 +77,8 @@ class ForumTestCase (TestCase): | @@ -77,6 +77,8 @@ class ForumTestCase (TestCase): | ||
77 | self.forum.save() | 77 | self.forum.save() |
78 | 78 | ||
79 | def test_create_forum (self): | 79 | def test_create_forum (self): |
80 | + list_forum = Forum.objects.all().count() | ||
81 | + | ||
80 | forum = Forum.objects.create( | 82 | forum = Forum.objects.create( |
81 | topic=self.topic, | 83 | topic=self.topic, |
82 | name = 'forum test2', | 84 | name = 'forum test2', |
@@ -87,20 +89,18 @@ class ForumTestCase (TestCase): | @@ -87,20 +89,18 @@ class ForumTestCase (TestCase): | ||
87 | ) | 89 | ) |
88 | forum.save() | 90 | forum.save() |
89 | 91 | ||
90 | - self.assertEquals(forum, Forum.objects.filter(name='forum test2')[0]) | 92 | + self.assertEquals(list_forum+1, Forum.objects.all().count()) |
91 | 93 | ||
92 | - def test_update_forum(self): | 94 | + def test_update_forum(self): |
95 | + list_forum = Forum.objects.all().count() | ||
93 | self.forum.name = 'forum test updated' | 96 | self.forum.name = 'forum test updated' |
94 | self.forum.save() | 97 | self.forum.save() |
95 | 98 | ||
96 | self.assertEquals(self.forum, Forum.objects.get(name='forum test updated')) | 99 | self.assertEquals(self.forum, Forum.objects.get(name='forum test updated')) |
100 | + self.assertEquals(list_forum, Forum.objects.all().count()) | ||
97 | 101 | ||
98 | def test_delete_forum (self): | 102 | def test_delete_forum (self): |
99 | - forum = Forum.objects.get(name='forum test') | 103 | + list_forum = Forum.objects.all().count() |
100 | self.forum.delete() | 104 | self.forum.delete() |
101 | 105 | ||
102 | - try: | ||
103 | - forum = Forum.objects.get(name='forum test') | ||
104 | - except: | ||
105 | - pass | ||
106 | - | ||
107 | \ No newline at end of file | 106 | \ No newline at end of file |
107 | + self.assertEquals(list_forum-1, Forum.objects.all().count()) | ||
108 | \ No newline at end of file | 108 | \ No newline at end of file |