def test_get_strategy_all(self): picker = checks.Picker(configuration.Checks('all', []), {"checks": [{ "id": 1 }, { "id": 2 }]}) assert picker.filter() == [{'id': 1}, {'id': 2}]
def test_get_strategy_exclude_all(self): picker = checks.Picker(configuration.Checks('exclude', [1, 2]), {"checks": [{ "id": 1 }, { "id": 2 }]}) assert picker.filter() == []
def test_get_strategy_exclude_none(self): picker = checks.Picker(configuration.Checks('exclude', [5]), {"checks": [{ "id": 1 }, { "id": 2 }]}) assert picker.filter() == [{'id': 1}, {'id': 2}]
def test_is_strategy_exclude(self): checks = configuration.Checks('exclude', [123]) assert checks.is_strategy_exclude() checks = configuration.Checks('all', []) assert not checks.is_strategy_exclude()
def test_is_strategy_all(self): checks = configuration.Checks('all', []) assert checks.is_strategy_all() checks = configuration.Checks('include', []) assert not checks.is_strategy_all()
def test_strategty_all_with_ids(self): with pytest.raises(ValueError): configuration.Checks('all', [1, 2])
def test_strategy_unrecognized(self): with pytest.raises(ValueError): configuration.Checks('t', [])