Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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())
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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())
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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)