bugfix test_get_devices

This commit is contained in:
Cayo Puigdefabregas 2020-07-22 12:11:21 +02:00
parent a90b4c9b9d
commit a005d6f597
2 changed files with 11 additions and 9 deletions

View File

@ -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)

View File

@ -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