diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index a8d9e816..50c0d18d 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -695,9 +695,31 @@ def test_snapshot_failed_end_time_bug(app: Devicehub, user: UserClient): """ This test check if the end_time = 0001-01-01 00:00:00+00:00 and then we get a /devices, this create a crash """ - snapshot = file('asus-end_time_bug88.snapshot') - user.post(res=Snapshot, data=snapshot) - devices, _ = user.get("/devices/") + snapshot_file = file('asus-end_time_bug88.snapshot') + snapshot, _ = user.post(res=Snapshot, data=snapshot_file) + device, _ = user.get(res=m.Device, item=snapshot['device']['id']) + end_times = [x['endTime'] for x in device['actions']] + + assert '1970-01-02T00:00:00+00:00' in end_times + assert not '0001-01-01T00:00:00+00:00' in end_times + + tmp_snapshots = app.config['TMP_SNAPSHOTS'] + shutil.rmtree(tmp_snapshots) + +@pytest.mark.mvp +def test_snapshot_not_failed_end_time_bug(app: Devicehub, user: UserClient): + """ This test check if the end_time != 0001-01-01 00:00:00+00:00 + and then we get a /devices, this create a crash + """ + snapshot_file = file('asus-end_time_bug88.snapshot') + snapshot_file['endTime'] = '2001-01-01 00:00:00+00:00' + snapshot, _ = user.post(res=Snapshot, data=snapshot_file) + device, _ = user.get(res=m.Device, item=snapshot['device']['id']) + end_times = [x['endTime'] for x in device['actions']] + + assert not '1970-01-02T00:00:00+00:00' in end_times + assert not '0001-01-01T00:00:00+00:00' in end_times + assert '2001-01-01T00:00:00+00:00' in end_times tmp_snapshots = app.config['TMP_SNAPSHOTS'] shutil.rmtree(tmp_snapshots)