test backup snapshot
This commit is contained in:
parent
e6b2a92f7f
commit
236806466a
|
@ -22,6 +22,7 @@ from ereuse_devicehub.resources.device.sync import MismatchBetweenProperties, \
|
||||||
from ereuse_devicehub.resources.enums import ComputerChassis, SnapshotSoftware
|
from ereuse_devicehub.resources.enums import ComputerChassis, SnapshotSoftware
|
||||||
from ereuse_devicehub.resources.tag import Tag
|
from ereuse_devicehub.resources.tag import Tag
|
||||||
from ereuse_devicehub.resources.user.models import User
|
from ereuse_devicehub.resources.user.models import User
|
||||||
|
from ereuse_devicehub.resources.views import TMP_SNAPSHOTS
|
||||||
from tests.conftest import file
|
from tests.conftest import file
|
||||||
|
|
||||||
|
|
||||||
|
@ -477,12 +478,20 @@ def test_pc_2(user: UserClient):
|
||||||
|
|
||||||
@pytest.mark.one
|
@pytest.mark.one
|
||||||
def test_backup_snapshot_with_error_500(user: UserClient):
|
def test_backup_snapshot_with_error_500(user: UserClient):
|
||||||
|
""" This test check if the file snapshot is create when some snapshot is wrong """
|
||||||
snapshot_no_hid = file('basic.snapshot.nohid')
|
snapshot_no_hid = file('basic.snapshot.nohid')
|
||||||
response_snapshot, response_status = user.post(res=Snapshot, data=snapshot_no_hid)
|
_, response_status = user.post(res=Snapshot, data=snapshot_no_hid)
|
||||||
assert response_snapshot['software'] == 'Workbench'
|
uuid = '9a3e7485-fdd0-47ce-bcc7-65c55226b598'
|
||||||
assert response_snapshot['version'] == '11.0b9'
|
files = [x for x in os.listdir(TMP_SNAPSHOTS) if uuid in x]
|
||||||
assert response_snapshot['uuid'] == '9a3e7485-fdd0-47ce-bcc7-65c55226b598'
|
|
||||||
assert response_snapshot['elapsed'] == 4
|
snapshot = {'software': '', 'version': '', 'uuid': ''}
|
||||||
assert response_snapshot['author']['id'] == user.user['id']
|
if files:
|
||||||
assert response_snapshot['severity'] == 'Warning'
|
path_snapshot = "{dir}/{file}".format(dir=TMP_SNAPSHOTS, file=files[0])
|
||||||
assert response_status.status_code == 201
|
file_snapshot = open(path_snapshot)
|
||||||
|
snapshot = json.loads(file_snapshot.read())
|
||||||
|
file_snapshot.close()
|
||||||
|
|
||||||
|
assert snapshot['software'] == 'Workbench'
|
||||||
|
assert snapshot['version'] == '11.0b9'
|
||||||
|
assert snapshot['uuid'] == uuid
|
||||||
|
assert response_status.status_code == 500
|
||||||
|
|
Reference in New Issue