fixed some tests

This commit is contained in:
Cayo Puigdefabregas 2020-11-12 21:00:33 +01:00
parent 791308d8e8
commit b56c3d3e0a
3 changed files with 6 additions and 11 deletions

View File

@ -5,11 +5,6 @@ device:
type: Desktop type: Desktop
chassis: Tower chassis: Tower
components: components:
- manufacturer: p1c4m
serialNumber: p1c4s
type: NetworkAdapter
speed: 1000
wireless: False
- manufacturer: p1c3m - manufacturer: p1c3m
serialNumber: p1c3s serialNumber: p1c3s
type: GraphicCard type: GraphicCard

File diff suppressed because one or more lines are too long

View File

@ -241,7 +241,7 @@ def test_snapshot_component_add_remove(user: UserClient):
# We register the first device but without the processor, # We register the first device but without the processor,
# adding a graphic card and adding a new component # adding a graphic card and adding a new component
s4 = file('4-first-device-but-removing-processor.snapshot-and-adding-graphic-card') s4 = file('4-first-device-but-removing-processor.snapshot-and-adding-graphic-card')
snapshot_and_check(user, s4, ('RateComputer',), perform_second_snapshot=False) snapshot4 = snapshot_and_check(user, s4, ('RateComputer',), perform_second_snapshot=False)
pc1, _ = user.get(res=m.Device, item=pc1_id) pc1, _ = user.get(res=m.Device, item=pc1_id)
pc2, _ = user.get(res=m.Device, item=pc2_id) pc2, _ = user.get(res=m.Device, item=pc2_id)
# Check if the update_timestamp is updated # Check if the update_timestamp is updated
@ -250,10 +250,10 @@ def test_snapshot_component_add_remove(user: UserClient):
assert not update4_pc1 in [update1_pc1, update2_pc1, update3_pc1] assert not update4_pc1 in [update1_pc1, update2_pc1, update3_pc1]
assert update3_pc2 == update2_pc2 assert update3_pc2 == update2_pc2
# PC 0: p1c3s, p1c4s. PC1: p2c1s # PC 0: p1c3s, p1c4s. PC1: p2c1s
assert {c['serialNumber'] for c in pc1['components']} == {'p1c3s', 'p1c4s'} assert {c['serialNumber'] for c in pc1['components']} == {'p1c3s'}
assert all(c['parent'] == pc1_id for c in pc1['components']) assert all(c['parent'] == pc1_id for c in pc1['components'])
# This last Action only # This last Action only
assert get_actions_info(pc1['actions'])[-1] == ('RateComputer', ['p1c3s', 'p1c4s']) assert get_actions_info(pc1['actions'])[-1] == ('RateComputer', ['p1c3s'])
# PC2 # PC2
# We haven't changed PC2 # We haven't changed PC2
assert tuple(c['serialNumber'] for c in pc2['components']) == ('p2c1s',) assert tuple(c['serialNumber'] for c in pc2['components']) == ('p2c1s',)