示例#1
0
 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())
示例#2
0
 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())
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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'])
示例#7
0
 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')
示例#8
0
 def test_response_times(self):
     ApplicationFactory(graphite_name='foo')
     response = self.c.get(reverse('response-time-dashboard'))
     self.assertEquals(response.status_code, 200)
示例#9
0
 def test_deprecated_application(self):
     application = ApplicationFactory(deprecated=True)
     response = self.c.get(reverse('index-view'))
     self.assertNotContains(response, application.get_absolute_url())
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 def test_deprecated_application(self):
     application = ApplicationFactory(deprecated=True)
     response = self.c.get("/")
     self.assertFalse(application.get_absolute_url() in response.content)
示例#13
0
 def test_deprecated_application(self):
     application = ApplicationFactory(deprecated=True)
     response = self.c.get(reverse('index-view'))
     self.assertNotContains(response, application.get_absolute_url())