mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02:00
metadata: check error messages are printed for more cases
This commit is contained in:
parent
b2fc59ef9a
commit
7c1d7fb4b3
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user