From 7c1d7fb4b313359311af4d8be1c773e635dd2661 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 3 May 2023 21:42:03 +0200 Subject: [PATCH] metadata: check error messages are printed for more cases --- tests/metadata.TestCase | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/metadata.TestCase b/tests/metadata.TestCase index 3a2879a6..f04d62a8 100755 --- a/tests/metadata.TestCase +++ b/tests/metadata.TestCase @@ -204,7 +204,8 @@ class MetadataTest(unittest.TestCase): ) @mock.patch('git.Repo') - def test_read_metadata(self, git_repo): + @mock.patch('logging.error') + def test_read_metadata(self, logging_error, git_repo): """Read specified metadata files included in tests/, compare to stored output""" self.maxDiff = None @@ -236,6 +237,10 @@ class MetadataTest(unittest.TestCase): # yaml.register_class(metadata.Build) # yaml.dump(frommeta, fp) + # errors are printed when .yml overrides localized + logging_error.assert_called() + self.assertEqual(3, len(logging_error.call_args_list)) + @mock.patch('git.Repo') def test_metadata_overrides_dot_fdroid_yml(self, git_Repo): """Fields in metadata files should override anything in .fdroid.yml.""" @@ -256,7 +261,8 @@ class MetadataTest(unittest.TestCase): metadata.parse_metadata(yml) # should not throw an exception @mock.patch('git.Repo') - def test_rewrite_yaml_fakeotaupdate(self, git_Repo): + @mock.patch('logging.error') + def test_rewrite_yaml_fakeotaupdate(self, logging_error, git_Repo): with tempfile.TemporaryDirectory() as testdir: testdir = Path(testdir) fdroidserver.common.config = {'accepted_formats': ['yml']} @@ -278,6 +284,10 @@ class MetadataTest(unittest.TestCase): (Path('metadata-rewrite-yml') / file_name).read_text(encoding='utf-8'), ) + # errors are printed when .yml overrides localized + logging_error.assert_called() + self.assertEqual(3, len(logging_error.call_args_list)) + @mock.patch('git.Repo') def test_rewrite_yaml_fdroidclient(self, git_Repo): with tempfile.TemporaryDirectory() as testdir: