This commit is contained in:
Cayo Puigdefabregas 2020-10-09 20:40:22 +02:00
parent 2a53e1672c
commit 99a12b2b22
2 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ def save_json(req_json):
The file need to be saved with one name format with the stamptime and uuid joins The file need to be saved with one name format with the stamptime and uuid joins
""" """
name_file = "{uuid}_{time}.json".format(uuid=req_json.get('uuid', ''), time=int(time())) name_file = "{uuid}_{time}.json".format(uuid=req_json.get('uuid', ''), time=int(time()))
path_name = os.path.join(tmp=TMP_SNAPSHOTS, file=name_file) path_name = os.path.join(TMP_SNAPSHOTS, name_file)
if not os.path.isdir(TMP_SNAPSHOTS): if not os.path.isdir(TMP_SNAPSHOTS):
os.system('mkdir -p {}'.format(TMP_SNAPSHOTS)) os.system('mkdir -p {}'.format(TMP_SNAPSHOTS))

View File

@ -491,7 +491,7 @@ def test_save_snapshot_in_file():
snapshot = {'software': '', 'version': '', 'uuid': ''} snapshot = {'software': '', 'version': '', 'uuid': ''}
if files: if files:
path_snapshot = os.path.join(dir=TMP_SNAPSHOTS, file=files[0]) path_snapshot = os.path.join(TMP_SNAPSHOTS, files[0])
file_snapshot = open(path_snapshot) file_snapshot = open(path_snapshot)
snapshot = json.loads(file_snapshot.read()) snapshot = json.loads(file_snapshot.read())
file_snapshot.close() file_snapshot.close()
@ -514,7 +514,7 @@ def test_backup_snapshot_with_errors(user: UserClient):
files = [x for x in os.listdir(TMP_SNAPSHOTS) if uuid in x] files = [x for x in os.listdir(TMP_SNAPSHOTS) if uuid in x]
if files: if files:
path_snapshot = os.path.join(dir=TMP_SNAPSHOTS, file=files[0]) path_snapshot = os.path.join(TMP_SNAPSHOTS, files[0])
file_snapshot = open(path_snapshot) file_snapshot = open(path_snapshot)
snapshot = json.loads(file_snapshot.read()) snapshot = json.loads(file_snapshot.read())
file_snapshot.close() file_snapshot.close()