示例#1
0
 def test_get_strategy_all(self):
     picker = checks.Picker(configuration.Checks('all', []),
                            {"checks": [{
                                "id": 1
                            }, {
                                "id": 2
                            }]})
     assert picker.filter() == [{'id': 1}, {'id': 2}]
示例#2
0
 def test_get_strategy_exclude_all(self):
     picker = checks.Picker(configuration.Checks('exclude', [1, 2]),
                            {"checks": [{
                                "id": 1
                            }, {
                                "id": 2
                            }]})
     assert picker.filter() == []
示例#3
0
 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}]
示例#4
0
 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()
示例#5
0
 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()
示例#6
0
 def test_strategty_all_with_ids(self):
     with pytest.raises(ValueError):
         configuration.Checks('all', [1, 2])
示例#7
0
 def test_strategy_unrecognized(self):
     with pytest.raises(ValueError):
         configuration.Checks('t', [])