From a005d6f597e13f1051bc7bf705f4ad9e871e419a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 22 Jul 2020 12:11:21 +0200 Subject: [PATCH] bugfix test_get_devices --- tests/test_device.py | 14 ++++++++------ tests/test_lot.py | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_device.py b/tests/test_device.py index 2f84c75d..85e15747 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -391,14 +391,14 @@ def test_sync_execute_register_mismatch_between_tags_and_hid(): @pytest.mark.mvp -@pytest.mark.xfail(reason='It needs to be fixed.') def test_get_device(app: Devicehub, user: UserClient): """Checks GETting a d.Desktop with its components.""" with app.app_context(): pc = d.Desktop(model='p1mo', manufacturer='p1ma', serial_number='p1s', - chassis=ComputerChassis.Tower) + chassis=ComputerChassis.Tower, + owner_id=user.user['id']) pc.components = OrderedSet([ d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s'), d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500) @@ -428,14 +428,14 @@ def test_get_device(app: Devicehub, user: UserClient): @pytest.mark.mvp -@pytest.mark.xfail(reason='It needs to be fixed.') def test_get_devices(app: Devicehub, user: UserClient): """Checks GETting multiple devices.""" with app.app_context(): pc = d.Desktop(model='p1mo', manufacturer='p1ma', serial_number='p1s', - chassis=ComputerChassis.Tower) + chassis=ComputerChassis.Tower, + owner_id=user.user['id']) pc.components = OrderedSet([ d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s'), d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500) @@ -443,11 +443,13 @@ def test_get_devices(app: Devicehub, user: UserClient): pc1 = d.Desktop(model='p2mo', manufacturer='p2ma', serial_number='p2s', - chassis=ComputerChassis.Tower) + chassis=ComputerChassis.Tower, + owner_id=user.user['id']) pc2 = d.Laptop(model='p3mo', manufacturer='p3ma', serial_number='p3s', - chassis=ComputerChassis.Netbook) + chassis=ComputerChassis.Netbook, + owner_id=user.user['id']) db.session.add_all((pc, pc1, pc2)) db.session.commit() devices, _ = user.get(res=d.Device) diff --git a/tests/test_lot.py b/tests/test_lot.py index c1473496..d6df96ef 100644 --- a/tests/test_lot.py +++ b/tests/test_lot.py @@ -13,7 +13,7 @@ from tests import conftest try: with db.session.begin_nested(): - + except Exception as e: db.session.commit() print(e) @@ -351,7 +351,6 @@ def test_lot_post_add_children_view_ui_tree_normal(user: UserClient): @pytest.mark.mvp -@pytest.mark.xfail(reason='It needs to be fixed.') def test_lot_post_add_remove_device_view(app: Devicehub, user: UserClient): """Tests adding a device to a lot using POST and removing it with DELETE. @@ -361,7 +360,8 @@ def test_lot_post_add_remove_device_view(app: Devicehub, user: UserClient): device = Desktop(serial_number='foo', model='bar', manufacturer='foobar', - chassis=ComputerChassis.Lunchbox) + chassis=ComputerChassis.Lunchbox, + owner_id=user.user['id']) db.session.add(device) db.session.commit() device_id = device.id