Merge pull request #81 from eReuse/bugfix/74-json-backup-time-in-name

Bugfix/74 json backup time in name
This commit is contained in:
cayop 2020-10-29 19:08:31 +01:00 committed by GitHub
commit f7f7432c4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -32,7 +32,7 @@ def save_json(req_json, tmp_snapshots, user):
month = now.month month = now.month
day = now.day day = now.day
hour = now.hour hour = now.hour
minutes = now.min minutes = now.minute
name_file = f"{year}-{month}-{day}-{hour}-{minutes}_{user}_{uuid}.json" name_file = f"{year}-{month}-{day}-{hour}-{minutes}_{user}_{uuid}.json"
path_name = os.path.join(tmp_snapshots, name_file) path_name = os.path.join(tmp_snapshots, name_file)

View file

@ -528,6 +528,7 @@ def test_save_snapshot_in_file(app: Devicehub, user: UserClient):
snapshot = {'software': '', 'version': '', 'uuid': ''} snapshot = {'software': '', 'version': '', 'uuid': ''}
if files: if files:
path_snapshot = os.path.join(tmp_snapshots, files[0]) path_snapshot = os.path.join(tmp_snapshots, files[0])
assert not "0001-01-01 00:00:00" in path_snapshot
with open(path_snapshot) as file_snapshot: with open(path_snapshot) as file_snapshot:
snapshot = json.loads(file_snapshot.read()) snapshot = json.loads(file_snapshot.read())