def test_find_by_key_single(self, key): ''' Test that it is possible to find the license by various keys ''' value = getattr(MITLicense, key) result = license.find_by_key(key, value, multiple=False) assert result == MITLicense
def test_find_by_key_single_wrong(self, key): ''' Test that when finding single result, KeyError is risen when nothing found ''' value = 'nonexistent value' with pytest.raises(KeyError): result = license.find_by_key(key, value, multiple=False)
def test_find_by_key_multiple_wrong(self, key): ''' Test that when finding multiple results, empty list is returned when nothing found ''' value = 'nonexistent value' results = license.find_by_key(key, value) assert results == []
def test_bsd_finds_multiple(self): ''' Test that searching for BSD in rpm key return at least two results ''' results = license.find_by_key('rpm', 'BSD') assert len(results) >= 2