예제 #1
0
파일: tests.py 프로젝트: zbidi/commcare-hq
 def tearDownClass(cls):
     cls.web_user.delete()
     cls.application.delete()
     cls.domain_object.delete()
     for repeater in FormRepeater.by_domain(cls.domain):
         repeater.delete()
     super(TestZapierIntegration, cls).tearDownClass()
예제 #2
0
 def tearDownClass(cls):
     cls.web_user.delete()
     cls.application.delete()
     cls.domain_object.delete()
     for repeater in FormRepeater.by_domain(cls.domain):
         repeater.delete()
     super(TestZapierIntegration, cls).tearDownClass()
예제 #3
0
 def tearDownClass(cls):
     ZAPIER_INTEGRATION.set('domain:{}'.format(cls.domain), False)
     cls.web_user.delete()
     cls.application.delete()
     cls.domain_object.delete()
     for repeater in FormRepeater.by_domain(cls.domain):
         repeater.delete()
     super(TestZapierIntegration, cls).tearDownClass()
예제 #4
0
 def test_unsubscribe_form(self):
     ZapierSubscription.objects.create(
         url=ZAPIER_URL,
         user_id=self.web_user.get_id,
         domain=TEST_DOMAIN,
         event_name=EventTypes.NEW_FORM,
         application_id=self.application.get_id,
         form_xmlns=FORM_XMLNS)
     data = {"subscription_url": ZAPIER_URL, "target_url": ZAPIER_URL}
     response = self.client.post(
         reverse(UnsubscribeView.urlname, kwargs={'domain': self.domain}),
         data=json.dumps(data),
         content_type='application/json; charset=utf-8',
         HTTP_AUTHORIZATION='ApiKey test:{}'.format(self.api_key))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(ZapierSubscription.objects.all().count(), 0)
     self.assertEqual(len(FormRepeater.by_domain(TEST_DOMAIN)), 0)
예제 #5
0
 def test_unsubscribe(self):
     ZapierSubscription.objects.create(
         url=ZAPIER_URL,
         user_id=self.web_user.get_id,
         domain=TEST_DOMAIN,
         event_name=consts.EventTypes.NEW_FORM,
         application_id=self.application.get_id,
         form_xmlns=FORM_XMLNS
     )
     data = {
         "subscription_url": ZAPIER_URL,
         "target_url": ZAPIER_URL
     }
     response = self.client.post(reverse('zapier_unsubscribe', kwargs={'domain': self.domain}),
                                 data=json.dumps(data),
                                 content_type='application/json; charset=utf-8',
                                 HTTP_AUTHORIZATION='ApiKey test:{}'.format(self.api_key))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(ZapierSubscription.objects.all().count(), 0)
     self.assertEqual(len(FormRepeater.by_domain(TEST_DOMAIN)), 0)