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))
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))
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')
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')
def test_domain_namespace_disabled(self): toggle = PredictablyRandomToggle( 'domain_toggle', 'A toggle for testing', TAG_CUSTOM, [NAMESPACE_DOMAIN], randomness=0.01 ) self.assertTrue(toggle.enabled('dc', namespace=NAMESPACE_DOMAIN)) self.assertFalse(toggle.enabled('marvel', namespace=NAMESPACE_DOMAIN))
def test_domain_namespace_invalid(self): toggle = PredictablyRandomToggle( 'test_toggle', 'A toggle for testing', TAG_CUSTOM, [NAMESPACE_DOMAIN], randomness=0.99 ) with self.assertRaises(ValueError): toggle.enabled('marvel')
def test_user_namespace_disabled(self): toggle = PredictablyRandomToggle( 'user_toggle', 'A toggle for testing', TAG_CUSTOM, [NAMESPACE_USER], randomness=0.01 ) self.assertTrue(toggle.enabled('diana', namespace=NAMESPACE_USER)) self.assertFalse(toggle.enabled('jessica', namespace=NAMESPACE_USER))
def test_user_namespace_invalid(self): toggle = PredictablyRandomToggle( 'test_toggle', 'A toggle for testing', TAG_CUSTOM, [NAMESPACE_USER], randomness=0.99 ) with self.assertRaises(ValueError): toggle.enabled('jessica')
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'))
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))
def test_all_namespaces_none_given(self): toggle = PredictablyRandomToggle( 'test_toggle', 'A toggle for testing', TAG_CUSTOM, [NAMESPACE_USER, NAMESPACE_DOMAIN], randomness=0.99 ) self.assertTrue(toggle.enabled('diana'))
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))