Exemplo n.º 1
0
 def test_user_namespace_disabled(self):
     toggle = PredictablyRandomToggle('user_toggle',
                                      'A toggle for testing',
                                      TAG_EXPERIMENTAL, [NAMESPACE_USER],
                                      randomness=0.01)
     self.assertTrue(toggle.enabled('diana', namespace=NAMESPACE_USER))
     self.assertFalse(toggle.enabled('jessica', namespace=NAMESPACE_USER))
Exemplo n.º 2
0
 def test_domain_namespace_disabled(self):
     toggle = PredictablyRandomToggle('domain_toggle',
                                      'A toggle for testing',
                                      TAG_EXPERIMENTAL, [NAMESPACE_DOMAIN],
                                      randomness=0.01)
     self.assertTrue(toggle.enabled('dc', namespace=NAMESPACE_DOMAIN))
     self.assertFalse(toggle.enabled('marvel', namespace=NAMESPACE_DOMAIN))
Exemplo n.º 3
0
 def test_domain_namespace_invalid(self):
     toggle = PredictablyRandomToggle('test_toggle',
                                      'A toggle for testing',
                                      TAG_EXPERIMENTAL, [NAMESPACE_DOMAIN],
                                      randomness=0.99)
     with self.assertRaises(ValueError):
         toggle.enabled('marvel')
Exemplo n.º 4
0
 def test_user_namespace_invalid(self):
     toggle = PredictablyRandomToggle('test_toggle',
                                      'A toggle for testing',
                                      TAG_EXPERIMENTAL, [NAMESPACE_USER],
                                      randomness=0.99)
     with self.assertRaises(ValueError):
         toggle.enabled('jessica')
Exemplo n.º 5
0
 def test_all_namespaces_none_given(self):
     toggle = PredictablyRandomToggle('test_toggle',
                                      'A toggle for testing',
                                      TAG_EXPERIMENTAL,
                                      [NAMESPACE_USER, NAMESPACE_DOMAIN],
                                      randomness=0.99)
     self.assertTrue(toggle.enabled('diana'))
Exemplo n.º 6
0
 def test_domain_namespace_enabled(self):
     toggle = PredictablyRandomToggle(
         'test_toggle',
         'A toggle for testing',
         TAG_CUSTOM,
         [NAMESPACE_DOMAIN],
         randomness=0.99
     )
     self.assertTrue(toggle.enabled('dc', namespace=NAMESPACE_DOMAIN))
Exemplo n.º 7
0
 def test_user_namespace_enabled(self):
     toggle = PredictablyRandomToggle(
         'test_toggle',
         'A toggle for testing',
         TAG_CUSTOM,
         [NAMESPACE_USER],
         randomness=0.99
     )
     self.assertTrue(toggle.enabled('arthur', namespace=NAMESPACE_USER))