示例#1
0
def create_app_structure_repeat_records(sender, application, **kwargs):
    from corehq.motech.repeaters.models import AppStructureRepeater
    domain = application.domain
    if domain:
        repeaters = AppStructureRepeater.by_domain(domain)
        for repeater in repeaters:
            repeater.register(application)
示例#2
0
def create_app_structure_repeat_records(sender, application, **kwargs):
    from corehq.motech.repeaters.models import AppStructureRepeater
    domain = application.domain
    if domain:
        repeaters = AppStructureRepeater.by_domain(domain)
        for repeater in repeaters:
            repeater.register(application)
示例#3
0
    def test_add_repeater(self):
        forwarding_url = 'https://example.com/forwarding'

        self.client.login(username=self.username, password=self.password)

        post_url = reverse('add_repeater', kwargs={'domain': self.domain.name, 'repeater_type': 'AppStructureRepeater'})
        response = self.client.post(post_url, {'url': forwarding_url}, follow=True)
        self.assertEqual(response.status_code, 200)

        self.client.logout()
        
        app_structure_repeaters = AppStructureRepeater.by_domain(self.domain.name)
        self.assertEqual(len(app_structure_repeaters), 1)

        for app_structure_repeater in app_structure_repeaters:
            app_structure_repeater.delete()
示例#4
0
    def test_add_repeater(self):
        forwarding_url = 'https://example.com/forwarding'

        self.client.login(username=self.username, password=self.password)

        post_url = reverse('add_repeater', kwargs={'domain': self.domain.name, 'repeater_type': 'AppStructureRepeater'})
        response = self.client.post(post_url, {'url': forwarding_url}, follow=True)
        self.assertEqual(response.status_code, 200)

        self.client.logout()
        
        app_structure_repeaters = AppStructureRepeater.by_domain(self.domain.name)
        self.assertEqual(len(app_structure_repeaters), 1)

        for app_structure_repeater in app_structure_repeaters:
            app_structure_repeater.delete()
示例#5
0
    def test_add_repeater(self):
        self.client.login(username=self.username, password=self.password)

        with connection_fixture(self.domain.name) as connx:
            post_url = reverse('add_repeater',
                               kwargs={
                                   'domain': self.domain.name,
                                   'repeater_type': 'AppStructureRepeater'
                               })
            response = self.client.post(post_url,
                                        {'connection_settings_id': connx.id},
                                        follow=True)
            self.assertEqual(response.status_code, 200)

            app_structure_repeaters = AppStructureRepeater.by_domain(
                self.domain.name)
            self.assertEqual(len(app_structure_repeaters), 1)

            for app_structure_repeater in app_structure_repeaters:
                app_structure_repeater.delete()

        self.client.logout()