fixed tests_devices

This commit is contained in:
Cayo Puigdefabregas 2020-11-03 20:26:32 +01:00
parent 50a7b59957
commit abe7783b93
1 changed files with 14 additions and 12 deletions

View File

@ -128,7 +128,6 @@ def test_physical_properties():
'ethereum_address': None, 'ethereum_address': None,
'manufacturer': 'bar', 'manufacturer': 'bar',
'model': 'foo', 'model': 'foo',
'owner_id': pc.owner_id,
'receiver_id': None, 'receiver_id': None,
'serial_number': 'foo-bar', 'serial_number': 'foo-bar',
'transfer_state': TransferState.Initial 'transfer_state': TransferState.Initial
@ -401,8 +400,9 @@ def test_get_device(app: Devicehub, user: UserClient):
chassis=ComputerChassis.Tower, chassis=ComputerChassis.Tower,
owner_id=user.user['id']) owner_id=user.user['id'])
pc.components = OrderedSet([ pc.components = OrderedSet([
d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s'), d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s',
d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500) owner_id=user.user['id']),
d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500, owner_id=user.user['id'])
]) ])
db.session.add(pc) db.session.add(pc)
# todo test is an abstract class. replace with another one # todo test is an abstract class. replace with another one
@ -438,8 +438,10 @@ def test_get_devices(app: Devicehub, user: UserClient):
chassis=ComputerChassis.Tower, chassis=ComputerChassis.Tower,
owner_id=user.user['id']) owner_id=user.user['id'])
pc.components = OrderedSet([ pc.components = OrderedSet([
d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s'), d.NetworkAdapter(model='c1mo', manufacturer='c1ma', serial_number='c1s',
d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500) owner_id=user.user['id']),
d.GraphicCard(model='c2mo', manufacturer='c2ma', memory=1500,
owner_id=user.user['id'])
]) ])
pc1 = d.Desktop(model='p2mo', pc1 = d.Desktop(model='p2mo',
manufacturer='p2ma', manufacturer='p2ma',
@ -551,22 +553,22 @@ def test_device_public(user: UserClient, client: Client):
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_computer_accessory_model(): def test_computer_accessory_model(user: UserClient):
sai = d.SAI() sai = d.SAI(owner_id=user.user['id'])
db.session.add(sai) db.session.add(sai)
keyboard = d.Keyboard(layout=Layouts.ES) keyboard = d.Keyboard(layout=Layouts.ES, owner_id=user.user['id'])
db.session.add(keyboard) db.session.add(keyboard)
mouse = d.Mouse() mouse = d.Mouse(owner_id=user.user['id'])
db.session.add(mouse) db.session.add(mouse)
db.session.commit() db.session.commit()
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_networking_model(): def test_networking_model(user: UserClient):
router = d.Router(speed=1000, wireless=True) router = d.Router(speed=1000, wireless=True, owner_id=user.user['id'])
db.session.add(router) db.session.add(router)
switch = d.Switch(speed=1000, wireless=False) switch = d.Switch(speed=1000, wireless=False, owner_id=user.user['id'])
db.session.add(switch) db.session.add(switch)
db.session.commit() db.session.commit()