Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Commit

Permalink
Ignore order of test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed Mar 26, 2017
1 parent 42a99bb commit b8de3b4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/kawaz/apps/blogs/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def test_published_with_authenticated(self):
user = PersonaFactory()
qs = Entry.objects.published(user)
self.assertEqual(qs.count(), 2)
self.assertEqual(qs[0], self.entries[1])
self.assertEqual(qs[1], self.entries[0])
self.assertIn(self.entries[0], qs)
self.assertIn(self.entries[1], qs)

def test_published_with_wille(self):
'''Tests Entry.objects.published() with wille user returns only public entries '''
Expand Down
9 changes: 5 additions & 4 deletions src/kawaz/apps/blogs/tests/views/test_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,9 @@ def test_authenticated_can_view_all_publish_entries(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[1], 'protected')
self.assertEqual(list[1], self.entries[0], 'public')
self.assertIn(self.entries[1], list, 'protected')
self.assertIn(self.entries[0], list, 'public')


class EntryAuthorListViewTestCase(TestCase):
def setUp(self):
Expand Down Expand Up @@ -417,8 +418,8 @@ def test_authenticated_can_view_all_publish_entries_of_the_author(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[3], 'protected')
self.assertEqual(list[1], self.entries[1], 'public')
self.assertIn(self.entries[3], list, 'protected')
self.assertIn(self.entries[1], list, 'public')
self.assertEqual(r.context_data['author'], self.user)


Expand Down
30 changes: 15 additions & 15 deletions src/kawaz/apps/blogs/tests/views/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def test_authenticated_can_view_all_publish_entries(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[1], 'protected')
self.assertEqual(list[1], self.entries[0], 'public')
self.assertIn(self.entries[1], list, 'protected')
self.assertIn(self.entries[0], list, 'public')


class EntryAuthorMonthArchiveViewTestCase(TestCase):
def setUp(self):
Expand Down Expand Up @@ -226,8 +227,9 @@ def test_authenticated_can_view_all_publish_entries_of_the_author(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[3], 'protected')
self.assertEqual(list[1], self.entries[1], 'public')
self.assertIn(self.entries[3], list, 'protected')
self.assertIn(self.entries[1], list, 'public')


class EntryDayArchiveViewTestCase(TestCase):
def setUp(self):
Expand Down Expand Up @@ -282,8 +284,9 @@ def test_authenticated_can_view_all_publish_entries(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[1], 'protected')
self.assertEqual(list[1], self.entries[0], 'public')
self.assertIn(self.entries[1], list, 'protected')
self.assertIn(self.entries[0], list, 'public')


class EntryAuthorDayArchiveViewTestCase(TestCase):
def setUp(self):
Expand Down Expand Up @@ -339,8 +342,8 @@ def test_authenticated_can_view_all_publish_entries_of_the_author(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[3], 'protected')
self.assertEqual(list[1], self.entries[1], 'public')
self.assertIn(self.entries[3], list, 'protected')
self.assertIn(self.entries[1], list, 'public')


class EntryTodayArchiveViewTestCase(TestCase):
Expand Down Expand Up @@ -396,8 +399,8 @@ def test_authenticated_can_view_all_publish_entries(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[1], 'protected')
self.assertEqual(list[1], self.entries[0], 'public')
self.assertIn(self.entries[1], list, 'protected')
self.assertIn(self.entries[0], list, 'public')

class EntryAuthorTodayArchiveViewTestCase(TestCase):
def setUp(self):
Expand All @@ -420,7 +423,6 @@ def test_anonymous_can_view_only_public_entries_of_the_author(self):
Tests anonymous user can view public Entry written by specific author on today only.
The protected entries are not displayed.
'''
entry = self.entries[0]
r = self.client.get('/blogs/{}/today/'.format(self.user.username))
self.assertTemplateUsed('blogs/entry_archive_day.html')
self.assertTrue('object_list' in r.context_data)
Expand All @@ -433,7 +435,6 @@ def test_wille_can_view_only_public_entries_of_the_author(self):
Tests wille user can view public Entry written by specific author on today only.
The protected entries are not displayed.
'''
entry = self.entries[0]
self.assertTrue(self.client.login(username=self.wille, password='password'))
r = self.client.get('/blogs/{}/today/'.format(self.user.username))
self.assertTemplateUsed('blogs/entry_archive_day.html')
Expand All @@ -446,12 +447,11 @@ def test_authenticated_can_view_all_publish_entries_of_the_author(self):
'''
Tests authenticated user can view all published entries written by specific author on today.
'''
entry = self.entries[0]
self.assertTrue(self.client.login(username=self.user, password='password'))
r = self.client.get('/blogs/{}/today/'.format(self.user.username))
self.assertTemplateUsed('blogs/entry_archive_day.html')
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two entries')
self.assertEqual(list[0], self.entries[3], 'protected')
self.assertEqual(list[1], self.entries[1], 'public')
self.assertIn(self.entries[3], list, 'protected')
self.assertIn(self.entries[1], list, 'public')
4 changes: 2 additions & 2 deletions src/kawaz/apps/projects/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ def test_authenticated_can_view_all_publish_projects(self):
self.assertTrue('object_list' in r.context_data)
list = r.context_data['object_list']
self.assertEqual(list.count(), 2, 'object_list has two projects')
self.assertEqual(list[0], self.projects[1], 'protected')
self.assertEqual(list[1], self.projects[0], 'public')
self.assertIn(self.projects[1], list, 'protected')
self.assertIn(self.projects[0], list, 'public')


class ProjectArchiveViewTestCase(ViewTestCaseBase):
Expand Down

0 comments on commit b8de3b4

Please sign in to comment.