Beispiel #1
0
 def test_enable(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn) | should.be_falsy()
     self.backend.enable(fn)
     self.backend.is_enabled(fn) | should.be_truthy()
Beispiel #2
0
 def test_enable(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn) | should.be_falsy()
     self.backend.enable(fn)
     self.backend.is_enabled(fn) | should.be_truthy()
Beispiel #3
0
 def test_add_a_disabled_functionality_with_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     f = self.backend._get_functionality(fn)
     f.name | should.eql(fn)
     f.percentage | should.eql(50)
     f.enabled | should.be_falsy()
     self.backend._redis.smembers("rollout:users:FOO") | should.be_empty()
Beispiel #4
0
 def test_add_a_disabled_functionality_with_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     f = self.backend._get_functionality(fn)
     f.name | should.eql(fn)
     f.percentage | should.eql(50)
     f.enabled | should.be_falsy()
     self.backend._redis.smembers("rollout:users:FOO") | should.be_empty()
Beispiel #5
0
 def test_add_a_disabled_functionality_with_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.get_functionalities() | should.have_len(1)
     f, users = self.backend._get_functionality(fn)
     f.name | should.eql(fn)
     f.percentage | should.eql(50)
     f.enabled | should.be_falsy()
     users | should.be_empty().and_array()
Beispiel #6
0
 def test_add_a_disabled_functionality_with_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.get_functionalities() | should.have_len(1)
     f, users = self.backend._get_functionality(fn)
     f.name | should.eql(fn)
     f.percentage | should.eql(50)
     f.enabled | should.be_falsy()
     users | should.be_empty().and_array()
Beispiel #7
0
 def test_is_enabled_func_exists_but_is_disabled(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn) | should.be_falsy()
Beispiel #8
0
 def test_is_enabled_func_exists_but_is_disabled(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     func.enabled = False
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn) | should.be_falsy()