示例#1
0
 def tearDown(self):
     for user in self.users:
         django_user = user.get_django_user()
         django_user.delete()
         user.delete()
     delete_all_cases()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, TEST_DOMAIN, toggles.NAMESPACE_DOMAIN)
示例#2
0
 def tearDownClass(cls):
     for user in cls.users:
         django_user = user.get_django_user()
         django_user.delete()
         user.delete()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, TEST_DOMAIN, toggles.NAMESPACE_DOMAIN)
     super(CaseAPITest, cls).tearDownClass()
示例#3
0
 def tearDown(self):
     for user in self.users:
         django_user = user.get_django_user()
         django_user.delete()
         user.delete()
     delete_all_cases()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, TEST_DOMAIN, toggles.NAMESPACE_DOMAIN)
示例#4
0
 def tearDownClass(cls):
     for user in cls.users:
         django_user = user.get_django_user()
         django_user.delete()
         user.delete()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, TEST_DOMAIN,
                        toggles.NAMESPACE_DOMAIN)
     super(CaseAPITest, cls).tearDownClass()
示例#5
0
 def setUp(self):
     self.project = Domain(name=self.domain)
     self.project.save()
     clear_toggle_cache(NEW_EXPORTS.slug,
                        self.domain,
                        namespace=NAMESPACE_DOMAIN)
     set_toggle(NEW_EXPORTS.slug,
                self.domain,
                False,
                namespace=NAMESPACE_DOMAIN)
示例#6
0
    def post(self, request, *args, **kwargs):
        toggle = self.get_toggle()
        item_list = request.POST.get('item_list', [])
        if item_list:
            item_list = json.loads(item_list)
            item_list = [u for u in item_list if u]

        affected_users = set(toggle.enabled_users) | set(item_list)
        toggle.enabled_users = item_list
        toggle.save()
        for item in affected_users:
            clear_toggle_cache(toggle.slug, item)

        data = {'item_list': item_list}
        return HttpResponse(json.dumps(data), mimetype="application/json")
示例#7
0
    def tearDown(self):
        self.contact.delete()
        self.backend.delete()
        self.backend_mapping.delete()

        delete_domain_phone_numbers(self.domain)
        SmsBillable.objects.filter(domain=self.domain).delete()
        QueuedSMS.objects.all().delete()
        SMS.objects.filter(domain=self.domain).delete()
        self.domain_obj.delete()

        clear_toggle_cache(RETRY_SMS_INDEFINITELY.slug, self.domain,
                           NAMESPACE_DOMAIN)

        super(QueueingTestCase, self).tearDown()
示例#8
0
def _call_save_fn_and_clear_cache(toggle_slug, changed_entries, currently_enabled, static_toggle):
    for entry in changed_entries:
        enabled = entry in currently_enabled
        namespace, entry = parse_toggle(entry)
        if namespace == NAMESPACE_DOMAIN:
            domain = entry
            if static_toggle.save_fn is not None:
                static_toggle.save_fn(domain, enabled)
            toggle_js_domain_cachebuster.clear(domain)
        else:
            # these are sent down with no namespace
            assert ':' not in entry, entry
            username = entry
            toggle_js_user_cachebuster.clear(username)

        clear_toggle_cache(toggle_slug, entry, namespace=namespace)
示例#9
0
    def post(self, request, *args, **kwargs):
        toggle = self.get_toggle()
        item_list = request.POST.get('item_list', [])
        if item_list:
            item_list = json.loads(item_list)
            item_list = [u.strip() for u in item_list if u and u.strip()]

        affected_users = set(toggle.enabled_users) | set(item_list)
        toggle.enabled_users = item_list
        toggle.save()
        for item in affected_users:
            clear_toggle_cache(toggle.slug, item)

        data = {
            'item_list': item_list
        }
        return HttpResponse(json.dumps(data), mimetype="application/json")
示例#10
0
    def post(self, request, *args, **kwargs):
        toggle = self.get_toggle()
        item_list = request.POST.get('item_list', [])
        if item_list:
            item_list = json.loads(item_list)
            item_list = [u.strip() for u in item_list if u and u.strip()]

        previously_enabled = set(toggle.enabled_users)
        currently_enabled = set(item_list)
        toggle.enabled_users = item_list
        toggle.save()

        changed_entries = previously_enabled ^ currently_enabled  # ^ means XOR
        self.call_save_fn(changed_entries, currently_enabled)
        for item in changed_entries:
            clear_toggle_cache(toggle.slug, item)

        data = {'item_list': item_list}
        return HttpResponse(json.dumps(data), content_type="application/json")
示例#11
0
    def test_toggle_cache(self):
        ns = 'ns'
        toggle = Toggle(slug=self.slug, enabled_users=['mojer', namespaced_item('fizbod', ns)])
        toggle.save()

        self.assertTrue(toggle_enabled(self.slug, 'mojer'))
        self.assertFalse(toggle_enabled(self.slug, 'fizbod'))
        self.assertTrue(toggle_enabled(self.slug, 'fizbod', namespace=ns))

        update_toggle_cache(self.slug, 'mojer', False)
        update_toggle_cache(self.slug, 'fizbod', False, namespace=ns)

        self.assertFalse(toggle_enabled(self.slug, 'mojer'))
        self.assertFalse(toggle_enabled(self.slug, 'fizbod', namespace=ns))

        clear_toggle_cache(self.slug, 'mojer')
        clear_toggle_cache(self.slug, 'fizbod', namespace=ns)

        self.assertTrue(toggle_enabled(self.slug, 'mojer'))
        self.assertTrue(toggle_enabled(self.slug, 'fizbod', namespace=ns))
示例#12
0
    def test_toggle_cache(self):
        ns = 'ns'
        toggle = Toggle(slug=self.slug, enabled_users=['mojer', namespaced_item('fizbod', ns)])
        toggle.save()

        self.assertTrue(toggle_enabled(self.slug, 'mojer'))
        self.assertFalse(toggle_enabled(self.slug, 'fizbod'))
        self.assertTrue(toggle_enabled(self.slug, 'fizbod', namespace=ns))

        update_toggle_cache(self.slug, 'mojer', False)
        update_toggle_cache(self.slug, 'fizbod', False, namespace=ns)

        self.assertFalse(toggle_enabled(self.slug, 'mojer'))
        self.assertFalse(toggle_enabled(self.slug, 'fizbod', namespace=ns))

        clear_toggle_cache(self.slug, 'mojer')
        clear_toggle_cache(self.slug, 'fizbod', namespace=ns)

        self.assertTrue(toggle_enabled(self.slug, 'mojer'))
        self.assertTrue(toggle_enabled(self.slug, 'fizbod', namespace=ns))
示例#13
0
    def post(self, request, *args, **kwargs):
        toggle = self.get_toggle()
        item_list = request.POST.get('item_list', [])
        if item_list:
            item_list = json.loads(item_list)
            item_list = [u.strip() for u in item_list if u and u.strip()]

        previously_enabled = set(toggle.enabled_users)
        currently_enabled = set(item_list)
        toggle.enabled_users = item_list
        toggle.save()

        changed_entries = previously_enabled ^ currently_enabled  # ^ means XOR
        self.call_save_fn(changed_entries, currently_enabled)
        for item in changed_entries:
            clear_toggle_cache(toggle.slug, item)

        data = {
            'item_list': item_list
        }
        return HttpResponse(json.dumps(data), content_type="application/json")
示例#14
0
 def tearDown(self):
     clear_toggle_cache(MODULE_FILTER.slug, 'domain', NAMESPACE_DOMAIN)
 def tearDownClass(cls):
     clear_toggle_cache(MOBILE_UCR.slug, cls.domain, NAMESPACE_DOMAIN)
示例#16
0
 def __exit__(self, exc_type, exc_val, exc_tb):
     clear_toggle_cache(self.toggle_slug, self.item, self.namespace)
 def tearDownClass(cls):
     clear_toggle_cache(MOBILE_UCR.slug, cls.domain, NAMESPACE_DOMAIN)
     super(ReportFiltersSuiteTest, cls).tearDownClass()
示例#18
0
 def tearDown(self):
     clear_toggle_cache(MODULE_FILTER.slug, 'domain', NAMESPACE_DOMAIN)
示例#19
0
 def tearDown(self):
     clear_toggle_cache(toggles.CUSTOM_PROPERTIES.slug, 'potter',
                        toggles.NAMESPACE_DOMAIN)
示例#20
0
 def tearDown(self):
     clear_toggle_cache(FILE_RESTORE.slug, USERNAME)
     super(FileRestoreSyncTokenCachingTest, self).tearDown()
示例#21
0
 def tearDown(self):
     self.suite_xml_is_usercase_in_use_patch.stop()
     clear_toggle_cache(MODULE_FILTER.slug, 'skelly', NAMESPACE_DOMAIN)
     clear_toggle_cache(MODULE_FILTER.slug, 'domain', NAMESPACE_DOMAIN)
     clear_toggle_cache(MODULE_FILTER.slug, 'example', NAMESPACE_DOMAIN)
示例#22
0
 def tearDown(self):
     clear_toggle_cache(toggles.CUSTOM_PROPERTIES.slug, 'potter', toggles.NAMESPACE_DOMAIN)
示例#23
0
 def do_teardown(cls):
     for user in cls.users:
         user.delete()
     cls.project.delete()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, TEST_DOMAIN, toggles.NAMESPACE_DOMAIN)
     FormProcessorTestUtils.delete_all_cases_forms_ledgers(TEST_DOMAIN)
示例#24
0
 def tearDown(self):
     self.suite_xml_is_usercase_in_use_patch.stop()
     clear_toggle_cache(MODULE_FILTER.slug, 'skelly', NAMESPACE_DOMAIN)
     clear_toggle_cache(MODULE_FILTER.slug, 'domain', NAMESPACE_DOMAIN)
     clear_toggle_cache(MODULE_FILTER.slug, 'example', NAMESPACE_DOMAIN)
示例#25
0
 def tearDown(self):
     clear_toggle_cache(toggles.FILE_RESTORE.slug, DUMMY_USERNAME)
     super(FileRestoreOtaRestoreTest, self).tearDown()
示例#26
0
 def tearDown(self):
     clear_toggle_cache(toggles.FILE_RESTORE.slug, self.user.username)
示例#27
0
 def __exit__(self, exc_type, exc_val, exc_tb):
     clear_toggle_cache(self.toggle_slug, self.item, self.namespace)
示例#28
0
 def tearDownClass(cls):
     cls.user.delete()
     clear_toggle_cache(toggles.CLOUDCARE_CACHE.slug, cls.domain, toggles.NAMESPACE_DOMAIN)
     FormProcessorTestUtils.delete_all_cases_forms_ledgers(cls.domain)
     cls.project.delete()
     super(CaseAPIMiscTests, cls).tearDownClass()
示例#29
0
 def tearDownClass(cls):
     clear_toggle_cache(MOBILE_UCR.slug, cls.domain, NAMESPACE_DOMAIN)
 def setUp(self):
     self.project = Domain(name=self.domain)
     self.project.save()
     clear_toggle_cache(OLD_EXPORTS.slug, self.domain, namespace=NAMESPACE_DOMAIN)
     set_toggle(OLD_EXPORTS.slug, self.domain, True, namespace=NAMESPACE_DOMAIN)