Ejemplo n.º 1
0
 def test_domain_namespace(self):
     domain_toggle = StaticToggle(
         'domain_namespace_toggle',
         'A test toggle',
         TAG_CUSTOM,
         [NAMESPACE_DOMAIN]
     )
     domain_toggle.set(self.domain.name, True, namespace=NAMESPACE_DOMAIN)
     self.assertTrue(domain_toggle.enabled(self.domain.name))
     self.assertFalse(domain_toggle.enabled(self.second_domain.name))
     self.assertTrue(domain_toggle.enabled_for_request(self.request))
     self.assertFalse(domain_toggle.enabled_for_request(self.second_request))
Ejemplo n.º 2
0
 def test_user_namespace(self):
     user_toggle = StaticToggle(
         'user_namespace_toggle',
         'A test toggle',
         TAG_CUSTOM,
         [NAMESPACE_USER]
     )
     user_toggle.set(self.user.username, True, namespace=NAMESPACE_USER)
     self.assertTrue(user_toggle.enabled(self.user.username))
     self.assertFalse(user_toggle.enabled(self.second_user.username))
     self.assertTrue(user_toggle.enabled_for_request(self.request))
     self.assertFalse(user_toggle.enabled_for_request(self.second_request))
Ejemplo n.º 3
0
 def test_email_domain_namespace(self):
     email_domain_toggle = StaticToggle(
         'email_domain_namespace_toggle',
         'A test toggle',
         TAG_CUSTOM,
         [NAMESPACE_EMAIL_DOMAIN]
     )
     email_domain_toggle.set('somedomain.com', True, namespace=NAMESPACE_EMAIL_DOMAIN)
     self.assertTrue(email_domain_toggle.enabled(self.user.username))
     self.assertFalse(email_domain_toggle.enabled(self.second_user.username))
     self.assertTrue(email_domain_toggle.enabled_for_request(self.request))
     self.assertFalse(email_domain_toggle.enabled_for_request(self.second_request))