update tests for fixed log deployment+changelog

This commit is contained in:
Michael Pöhn 2019-10-15 15:19:18 +02:00
parent d665106813
commit 7fa3c34e5b
3 changed files with 13 additions and 2 deletions

View File

@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
([!669](https://gitlab.com/fdroid/fdroidserver/merge_requests/669))
### Fixed
* fix build-logs dissapearing when deploying
([!685](https://gitlab.com/fdroid/fdroidserver/merge_requests/685))
* do not crash when system encoding can not be retrieved
([!671](https://gitlab.com/fdroid/fdroidserver/merge_requests/671))
* checkupdates: UpdateCheckIngore gets properly observed now

View File

@ -3253,6 +3253,9 @@ def deploy_build_log_with_rsync(appid, vercode, log_content):
logging.warning(_('skip deploying full build logs: log content is empty'))
return
if not os.path.exists('repo'):
os.mkdir('repo')
# gzip compress log file
log_gz_path = os.path.join('repo',
'{pkg}_{ver}.log.gz'.format(pkg=appid,

View File

@ -1008,8 +1008,14 @@ class CommonTest(unittest.TestCase):
with mock.patch('subprocess.call',
side_effect=assert_subprocess_call):
fdroidserver.common.deploy_build_log_with_rsync(
'com.example.app', '4711', mocklogcontent)
with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir):
fdroidserver.common.deploy_build_log_with_rsync(
'com.example.app', '4711', mocklogcontent)
expected_log_path = os.path.join(tmpdir, 'repo', 'com.example.app_4711.log.gz')
self.assertTrue(os.path.isfile(expected_log_path))
with gzip.open(expected_log_path, 'r') as f:
self.assertEqual(f.read(), mocklogcontent)
if __name__ == "__main__":