From 62e52f145ff03673cdf4ed0b13f306f026d64e11 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 13 Nov 2020 12:44:20 +0100 Subject: [PATCH] fixed bug in test --- tests/test_device.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test_device.py b/tests/test_device.py index 4ceb06a3..50e7c147 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -638,9 +638,11 @@ def test_hid_with_2networkadapters(app: Devicehub, user: UserClient): network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - s, _ = user.post(snapshot, res=m.Snapshot) - pc, _ = user.get(res=d.Device, item=1) + user.post(snapshot, res=m.Snapshot) + # pc, _ = user.get(res=d.Device, item=1) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' + devices, _ = user.get(res=d.Device) + assert len([c for c in devices['items'] if c['type'] == 'Laptop']) == 1 @pytest.mark.mvp @@ -651,17 +653,16 @@ def test_hid_with_2network_and_drop_no_mac_in_hid(app: Devicehub, user: UserClie network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - s, _ = user.post(snapshot, res=m.Snapshot) + user.post(snapshot, res=m.Snapshot) pc, _ = user.get(res=d.Device, item=1) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abb' snapshot['components'] = [c for c in snapshot['components'] if c != network] - s, _ = user.post(snapshot, res=m.Snapshot) - pc, _ = user.get(res=d.Device, item=1) - assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' + user.post(snapshot, res=m.Snapshot) devices, _ = user.get(res=d.Device) assert len([c for c in devices['items'] if c['type'] == 'Laptop']) == 1 + assert devices['items'][0]['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' @pytest.mark.mvp @@ -673,14 +674,14 @@ def test_hid_with_2network_and_drop_mac_in_hid(app: Devicehub, user: UserClient) network2 = copy.copy(network) snapshot['components'].append(network2) network['serialNumber'] = 'a0:24:8c:7f:cf:2d' - s, _ = user.post(snapshot, res=m.Snapshot) + user.post(snapshot, res=m.Snapshot) pc, _ = user.get(res=d.Device, item=1) assert pc['hid'] == 'laptop-asustek_computer_inc-1000h-94oaaq021116-00:24:8c:7f:cf:2d' # we drop the network card then is used for to build the hid snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abb' snapshot['components'] = [c for c in snapshot['components'] if c != network2] - s, _ = user.post(snapshot, res=m.Snapshot) + user.post(snapshot, res=m.Snapshot) devices, _ = user.get(res=d.Device) laptops = [c for c in devices['items'] if c['type'] == 'Laptop'] assert len(laptops) == 2 @@ -692,7 +693,7 @@ def test_hid_with_2network_and_drop_mac_in_hid(app: Devicehub, user: UserClient) # we drop all network cards snapshot['uuid'] = 'd1b70cb8-8929-4f36-99b7-fe052cec0abc' snapshot['components'] = [c for c in snapshot['components'] if not c in [network, network2]] - s, _ = user.post(snapshot, res=m.Snapshot) + user.post(snapshot, res=m.Snapshot) devices, _ = user.get(res=d.Device) laptops = [c for c in devices['items'] if c['type'] == 'Laptop'] assert len(laptops) == 3