Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def test_unknown_strategy(self):
assert not result[0](basically_anything_here='foo')
assert log.warning.called

def test_no_parameter(self):
strategies = {'Foo': mock.Mock(return_value='R')}
feature = {'strategies': [
{'name': 'Foo'},
]}

result = features.feature_gates(strategies, feature)
assert len(result) == 1
assert result == ['R']


class TestFeature(TestCase):
def test_happy_path(self):
Expand Down
2 changes: 1 addition & 1 deletion unleash_client/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def feature_gates(strategies, feature):
tests = []
for args in feature['strategies']:
name, parameters = args['name'], args['parameters']
name, parameters = args['name'], args.get('parameters', {})
strategy = strategies.get(name)
if strategy:
test = strategy(**parameters)
Expand Down