add test_check_metadata_AntiFeatures

This commit is contained in:
Hans-Christoph Steiner 2023-04-24 16:54:02 +02:00
parent c6ad8505d4
commit e5fda54693

View file

@ -180,6 +180,26 @@ class MetadataTest(unittest.TestCase):
'fake.app.id', 'fake.app.id',
) )
def test_check_metadata_AntiFeatures(self):
fdroidserver.metadata.warnings_action = 'error'
app = fdroidserver.metadata.App()
self.assertIsNone(metadata.check_metadata(app))
app['AntiFeatures'] = []
self.assertIsNone(metadata.check_metadata(app))
app['AntiFeatures'] = ['Ads', 'UpstreamNonFree']
self.assertIsNone(metadata.check_metadata(app))
app['AntiFeatures'] = ['Ad']
with self.assertRaises(fdroidserver.exception.MetaDataException):
metadata.check_metadata(app)
app['AntiFeatures'] = ['Adss']
with self.assertRaises(fdroidserver.exception.MetaDataException):
metadata.check_metadata(app)
def test_valid_funding_yml_regex(self): def test_valid_funding_yml_regex(self):
"""Check the regex can find all the cases""" """Check the regex can find all the cases"""
with (self.basedir / 'funding-usernames.yaml').open() as fp: with (self.basedir / 'funding-usernames.yaml').open() as fp: