From af9fe2d6b69ad310fd992e21f8b5bc3ecb7281d6 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 5 Nov 2020 16:31:57 +0100 Subject: [PATCH] fixing tests --- tests/test_agent.py | 6 +++--- tests/test_device.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_agent.py b/tests/test_agent.py index 2a3a360b..9d5f379e 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -3,7 +3,7 @@ from uuid import UUID import pytest from marshmallow import ValidationError from sqlalchemy_utils import PhoneNumber -from teal.db import UniqueViolation +from teal.db import UniqueViolation, DBError from teal.enums import Country from ereuse_devicehub.config import DevicehubConfig @@ -80,7 +80,7 @@ def test_membership_repeated(): db.session.add(person) person.member_of.add(Membership(org, person)) - with pytest.raises(UniqueViolation): + with pytest.raises(DBError): db.session.flush() @@ -95,7 +95,7 @@ def test_membership_repeating_id(): person2 = Person(name='Tommy') person2.member_of.add(Membership(org, person2, id='acme-1')) db.session.add(person2) - with pytest.raises(UniqueViolation) as e: + with pytest.raises(DBError) as e: db.session.flush() assert 'One member id per organization' in str(e) diff --git a/tests/test_device.py b/tests/test_device.py index b57e230c..9f3afcb8 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -574,8 +574,9 @@ def test_networking_model(user: UserClient): @pytest.mark.usefixtures(conftest.app_context.__name__) -def test_cooking_mixer(): - mixer = d.Mixer(serial_number='foo', model='bar', manufacturer='foobar') +def test_cooking_mixer(user: UserClient): + mixer = d.Mixer(serial_number='foo', model='bar', manufacturer='foobar', + owner_id=user.user['id']) db.session.add(mixer) db.session.commit()