コード例 #1
0
ファイル: test_views.py プロジェクト: yumsuresht/remo
 def test_get_list_featured_page(self):
     """Get list featuredrep page."""
     user = UserFactory.create(groups=['Admin'])
     FeaturedRepFactory.create_batch(3)
     response = self.get(url=reverse('featuredrep_list_featured'),
                         user=user)
     self.assertTemplateUsed(response, 'featuredrep_list.html')
コード例 #2
0
ファイル: test_views.py プロジェクト: Azeez09/remo
 def test_get_list_featured_page(self):
     """Get list featuredrep page."""
     user = UserFactory.create(groups=['Admin'])
     FeaturedRepFactory.create_batch(3)
     response = self.get(url=reverse('featuredrep_list_featured'),
                         user=user)
     self.assertTemplateUsed(response, 'featuredrep_list.html')
コード例 #3
0
ファイル: test_views.py プロジェクト: yumsuresht/remo
 def test_get_as_council(self):
     user = UserFactory.create(groups=['Council'])
     featured = FeaturedRepFactory.create()
     response = self.get(url=reverse('featuredrep_edit_featured',
                                     args=[featured.id]),
                         user=user)
     self.assertTemplateUsed(response, 'featuredrep_alter.html')
コード例 #4
0
ファイル: test_views.py プロジェクト: theparadoxer02/remo
 def test_delete_featured(self, redirect_mock):
     user = UserFactory.create(groups=['Admin'])
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         client.post(
             reverse('featuredrep_delete_featured', args=[featured.id]))
     ok_(not FeaturedRep.objects.filter(pk=featured.id).exists())
コード例 #5
0
ファイル: test_views.py プロジェクト: Azeez09/remo
 def test_get_as_council(self):
     user = UserFactory.create(groups=['Council'])
     featured = FeaturedRepFactory.create()
     response = self.get(url=reverse('featuredrep_edit_featured',
                                     args=[featured.id]),
                         user=user)
     self.assertTemplateUsed(response, 'featuredrep_alter.html')
コード例 #6
0
ファイル: test_views.py プロジェクト: theparadoxer02/remo
 def test_get_as_council(self):
     user = UserFactory.create(groups=['Council'])
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         response = client.get(
             reverse('featuredrep_edit_featured', args=[featured.id]))
     self.assertJinja2TemplateUsed(response, 'featuredrep_alter.jinja')
コード例 #7
0
ファイル: test_views.py プロジェクト: theparadoxer02/remo
 def test_get_as_other_user(self):
     user = UserFactory.create()
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         client.get(reverse('featuredrep_edit_featured',
                            args=[featured.id]),
                    follow=True)
コード例 #8
0
ファイル: test_views.py プロジェクト: Azeez09/remo
 def test_delete_featured(self, redirect_mock):
     user = UserFactory.create(groups=['Admin'])
     featured = FeaturedRepFactory.create()
     self.post(url=reverse('featuredrep_delete_featured',
                           args=[featured.id]),
               user=user)
     ok_(not FeaturedRep.objects.filter(pk=featured.id).exists())
コード例 #9
0
ファイル: test_views.py プロジェクト: yumsuresht/remo
 def test_delete_featured(self, redirect_mock):
     user = UserFactory.create(groups=['Admin'])
     featured = FeaturedRepFactory.create()
     self.post(url=reverse('featuredrep_delete_featured',
                           args=[featured.id]),
               user=user)
     ok_(not FeaturedRep.objects.filter(pk=featured.id).exists())
コード例 #10
0
ファイル: test_views.py プロジェクト: Josespaul/remo
 def test_edit_featured(self, form_mock, redirect_mock, messages_mock):
     form_mock.is_valid.return_value = True
     featured = FeaturedRepFactory.create()
     user = UserFactory.create(groups=['Admin'])
     with self.login(user) as client:
         response = client.post(reverse('featuredrep_edit_featured', args=[featured.id]),
                                user=user, follow=True)
     eq_(response.status_code, 200)
     messages_mock.assert_called_with(
         mock.ANY, 'Featured rep article successfuly edited.')
     ok_(form_mock().save.called)
コード例 #11
0
ファイル: test_views.py プロジェクト: yumsuresht/remo
 def test_edit_featured(self, form_mock, redirect_mock, messages_mock):
     form_mock.is_valid.return_value = True
     featured = FeaturedRepFactory.create()
     user = UserFactory.create(groups=['Admin'])
     response = self.post(url=reverse('featuredrep_edit_featured',
                                      args=[featured.id]),
                          user=user)
     eq_(response.status_code, 200)
     messages_mock.assert_called_with(
         mock.ANY, 'Featured rep article successfuly edited.')
     ok_(form_mock().save.called)
コード例 #12
0
ファイル: test_views.py プロジェクト: Josespaul/remo
 def test_delete_featured(self, redirect_mock):
     user = UserFactory.create(groups=['Admin'])
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         client.post(reverse('featuredrep_delete_featured', args=[featured.id]))
     ok_(not FeaturedRep.objects.filter(pk=featured.id).exists())
コード例 #13
0
ファイル: test_views.py プロジェクト: Josespaul/remo
 def test_get_list_featured_page(self):
     """Get list featuredrep page."""
     UserFactory.create(groups=['Admin'])
     FeaturedRepFactory.create_batch(3)
     response = Client().get(reverse('featuredrep_list_featured'))
     self.assertJinja2TemplateUsed(response, 'featuredrep_list.jinja')
コード例 #14
0
ファイル: test_views.py プロジェクト: Josespaul/remo
 def test_get_as_other_user(self):
     user = UserFactory.create()
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         client.get(reverse('featuredrep_edit_featured', args=[featured.id]), follow=True)
コード例 #15
0
ファイル: test_views.py プロジェクト: Josespaul/remo
 def test_get_as_council(self):
     user = UserFactory.create(groups=['Council'])
     featured = FeaturedRepFactory.create()
     with self.login(user) as client:
         response = client.get(reverse('featuredrep_edit_featured', args=[featured.id]))
     self.assertJinja2TemplateUsed(response, 'featuredrep_alter.jinja')
コード例 #16
0
ファイル: test_views.py プロジェクト: theparadoxer02/remo
 def test_get_list_featured_page(self):
     """Get list featuredrep page."""
     UserFactory.create(groups=['Admin'])
     FeaturedRepFactory.create_batch(3)
     response = Client().get(reverse('featuredrep_list_featured'))
     self.assertJinja2TemplateUsed(response, 'featuredrep_list.jinja')
コード例 #17
0
ファイル: test_views.py プロジェクト: Azeez09/remo
 def test_get_as_other_user(self):
     user = UserFactory.create()
     featured = FeaturedRepFactory.create()
     self.get(url=reverse('featuredrep_edit_featured', args=[featured.id]),
              user=user)
コード例 #18
0
ファイル: test_views.py プロジェクト: yumsuresht/remo
 def test_get_as_other_user(self):
     user = UserFactory.create()
     featured = FeaturedRepFactory.create()
     self.get(url=reverse('featuredrep_edit_featured', args=[featured.id]),
              user=user)