Adding test to check if upload snapshot without HID fields
This commit is contained in:
parent
713452e4e1
commit
115986c7e0
|
@ -0,0 +1,30 @@
|
|||
type: Snapshot
|
||||
uuid: 9a3e7485-fdd0-47ce-bcc7-65c55226b598
|
||||
version: '11.0b9'
|
||||
software: Workbench
|
||||
elapsed: 4
|
||||
device:
|
||||
type: Desktop
|
||||
chassis: Microtower
|
||||
serialNumber: null
|
||||
model: null
|
||||
manufacturer: null
|
||||
actions:
|
||||
- type: VisualTest
|
||||
appearanceRange: A
|
||||
functionalityRange: B
|
||||
components:
|
||||
- type: RamModule
|
||||
serialNumber: rm1s
|
||||
model: rm1ml
|
||||
manufacturer: rm1mr
|
||||
speed: 1333
|
||||
- type: Processor
|
||||
serialNumber: p1s
|
||||
model: p1ml
|
||||
manufacturer: p1mr
|
||||
speed: 1.6
|
||||
actions:
|
||||
- type: BenchmarkProcessor
|
||||
rate: 2410
|
||||
elapsed: 11
|
|
@ -32,7 +32,8 @@ def test_api_docs(client: Client):
|
|||
'/documents/static/{filename}',
|
||||
'/tags/{tag_id}/device/{device_id}',
|
||||
'/devices/static/{filename}',
|
||||
'/deliverynotes/'
|
||||
'/deliverynotes/',
|
||||
'/proofs/'
|
||||
}
|
||||
assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'}
|
||||
assert docs['components']['securitySchemes']['bearerAuth'] == {
|
||||
|
@ -43,4 +44,4 @@ def test_api_docs(client: Client):
|
|||
'scheme': 'basic',
|
||||
'name': 'Authorization'
|
||||
}
|
||||
assert len(docs['definitions']) == 116
|
||||
assert len(docs['definitions']) == 122
|
||||
|
|
|
@ -229,6 +229,28 @@ def _test_snapshot_computer_no_hid(user: UserClient):
|
|||
user.post(s, res=Snapshot)
|
||||
|
||||
|
||||
def test_snapshot_post_without_hid(user: UserClient):
|
||||
"""Tests the post snapshot endpoint (validation, etc), data correctness,
|
||||
and relationship correctness with HID field generated with type - model - manufacturer - S/N.
|
||||
"""
|
||||
snapshot = snapshot_and_check(user, file('basic.snapshot.nohid'),
|
||||
action_types=(
|
||||
BenchmarkProcessor.t,
|
||||
VisualTest.t,
|
||||
RateComputer.t
|
||||
),
|
||||
perform_second_snapshot=False)
|
||||
assert snapshot['software'] == 'Workbench'
|
||||
assert snapshot['version'] == '11.0b9'
|
||||
assert snapshot['uuid'] == '9a3e7485-fdd0-47ce-bcc7-65c55226b598'
|
||||
assert snapshot['elapsed'] == 4
|
||||
assert snapshot['author']['id'] == user.user['id']
|
||||
assert 'actions' not in snapshot['device']
|
||||
assert 'author' not in snapshot['device']
|
||||
response = user.post(snapshot, res=Snapshot)
|
||||
assert response.status == 201
|
||||
|
||||
|
||||
def test_snapshot_mismatch_id():
|
||||
"""Tests uploading a device with an ID from another device."""
|
||||
# Note that this won't happen as in this new version
|
||||
|
@ -417,6 +439,7 @@ def assert_similar_device(device1: dict, device2: dict):
|
|||
assert isinstance(device1, dict) and device1
|
||||
assert isinstance(device2, dict) and device2
|
||||
for key in 'serialNumber', 'model', 'manufacturer', 'type':
|
||||
if (device1.get(key, '') is not None) and (device2.get(key, '') is not None):
|
||||
assert device1.get(key, '').lower() == device2.get(key, '').lower()
|
||||
|
||||
|
||||
|
|
Reference in New Issue