def test_add_application_renewal(self): a = ApplicationFactory() response = self.c.post( reverse("add-application-renewal", args=(a.id, )), { "end": "2020-10-10", "notes": "this is a new renewal", }) self.assertEquals(response.status_code, 302) self.assertEqual(Lease.objects.count(), 1) self.assertTrue(a.valid_renewal())
def test_add_application_renewal(self): a = ApplicationFactory() response = self.c.post( reverse("add-application-renewal", args=(a.id,)), { "end": "2020-10-10", "notes": "this is a new renewal", } ) self.assertEquals(response.status_code, 302) self.assertEqual(Lease.objects.count(), 1) self.assertTrue(a.valid_renewal())
def test_alias_associate_with_application(self): alias = AliasFactory() application = ApplicationFactory() response = self.c.post( "/alias/%d/associate_with_application/" % alias.id, dict(application=application.id)) self.assertEqual(response.status_code, 302)
def test_add_application_contact(self): a = ApplicationFactory() response = self.c.post( reverse("add-application-contact", args=(a.id, )), {"contact": "ContactBob"}) self.assertEquals(response.status_code, 302) self.assertEqual(ApplicationContact.objects.count(), 1)
def test_add_application_note(self): a = ApplicationFactory() response = self.c.post(reverse("add-application-note", args=(a.id, )), {"body": "this is a note"}) self.assertEquals(response.status_code, 302) self.assertEqual(ApplicationNote.objects.count(), 1) self.assertEqual(Note.objects.count(), 1)
def test_renewals_dashboard(self): a = ApplicationFactory() b = ApplicationFactory() response = self.c.get(reverse('renewals-dashboard')) self.assertEquals(response.status_code, 200) self.assertTrue(a in response.context['apps_without_renewals']) self.assertTrue(b in response.context['apps_without_renewals']) # create a renewal for one response = self.c.post( reverse("add-application-renewal", args=(b.id, )), { "end": "2020-10-10", "notes": "this is a new renewal", }) response = self.c.get(reverse('renewals-dashboard')) self.assertEquals(response.status_code, 200) self.assertTrue(a in response.context['apps_without_renewals']) self.assertFalse(b in response.context['apps_without_renewals'])
def test_response_times_deprecated_app(self): ApplicationFactory(graphite_name='foobar', deprecated=True) response = self.c.get(reverse('response-time-dashboard')) self.assertEquals(response.status_code, 200) self.assertNotContains(response, 'foobar')
def test_response_times(self): ApplicationFactory(graphite_name='foo') response = self.c.get(reverse('response-time-dashboard')) self.assertEquals(response.status_code, 200)
def test_deprecated_application(self): application = ApplicationFactory(deprecated=True) response = self.c.get(reverse('index-view')) self.assertNotContains(response, application.get_absolute_url())
def test_application(self): application = ApplicationFactory() response = self.c.get("/application/%d/" % application.id) self.assertEqual(response.status_code, 200) self.assertEqual(response.context['application'], application)
def test_traffic_deprecated_app(self): ApplicationFactory(graphite_name='foobar', deprecated=True) response = self.c.get(reverse('traffic-dashboard')) self.assertEquals(response.status_code, 200) self.assertFalse('foobar' in response.content)
def test_deprecated_application(self): application = ApplicationFactory(deprecated=True) response = self.c.get("/") self.assertFalse(application.get_absolute_url() in response.content)