Exemple #1
0
 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')
Exemple #2
0
 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')
Exemple #3
0
 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')
Exemple #4
0
 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())
Exemple #5
0
 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')
Exemple #6
0
 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')
Exemple #7
0
 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)
Exemple #8
0
 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())
Exemple #9
0
 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())
Exemple #10
0
 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)
Exemple #11
0
 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)
Exemple #12
0
 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())
Exemple #13
0
 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')
Exemple #14
0
 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)
Exemple #15
0
 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')
Exemple #16
0
 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')
Exemple #17
0
 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)
Exemple #18
0
 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)