Ejemplo n.º 1
0
 def test_add_broadcast_perm_sees_detail_page_but_cant_review(self):
     self.staff_user.user_permissions.remove(
         Permission.objects.get(codename='approve_broadcast'))
     self.staff_user.user_permissions.add(Permission.objects.get(codename='read_broadcast'))
     batch = BatchFactory(status=Batch.PENDING)
     broadcast = Broadcast.objects.create(
         created_by=batch.created_by,
         batch=batch,
         audience=Broadcast.CUSTOM,
         message=batch.description
     )
     review_url = reverse('approve_reject_broadcast', kwargs=dict(broadcast_id=broadcast.id))
     # can see detail page
     rsp = self.client.get(reverse('read_broadcast', kwargs=dict(pk=broadcast.id)))
     self.assertEqual(200, rsp.status_code)
     # and can't manually go to review url
     rsp = self.client.post(review_url)
     self.assertEqual(403, rsp.status_code)
Ejemplo n.º 2
0
 def setUp(self):
     # create an approved Batch
     self.batch = BatchFactory(status=Batch.APPROVED)
Ejemplo n.º 3
0
 def test_time_remaining_zero_messages(self):
     batch = BatchFactory(status=Batch.PENDING)
     self.assertEqual(batch.time_remaining(), 0)
Ejemplo n.º 4
0
 def test_unicode_method(self):
     batch = BatchFactory(name=u'foo')
     self.assertEqual(str(batch), u'foo')
Ejemplo n.º 5
0
 def test_dont_get_deleted_batch_by_default(self):
     batch = BatchFactory(deleted=True)
     self.assertNotIn(batch, Batch.objects.all())