fixing tests
This commit is contained in:
parent
81da7cb9a8
commit
af9fe2d6b6
|
@ -3,7 +3,7 @@ from uuid import UUID
|
||||||
import pytest
|
import pytest
|
||||||
from marshmallow import ValidationError
|
from marshmallow import ValidationError
|
||||||
from sqlalchemy_utils import PhoneNumber
|
from sqlalchemy_utils import PhoneNumber
|
||||||
from teal.db import UniqueViolation
|
from teal.db import UniqueViolation, DBError
|
||||||
from teal.enums import Country
|
from teal.enums import Country
|
||||||
|
|
||||||
from ereuse_devicehub.config import DevicehubConfig
|
from ereuse_devicehub.config import DevicehubConfig
|
||||||
|
@ -80,7 +80,7 @@ def test_membership_repeated():
|
||||||
db.session.add(person)
|
db.session.add(person)
|
||||||
|
|
||||||
person.member_of.add(Membership(org, person))
|
person.member_of.add(Membership(org, person))
|
||||||
with pytest.raises(UniqueViolation):
|
with pytest.raises(DBError):
|
||||||
db.session.flush()
|
db.session.flush()
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ def test_membership_repeating_id():
|
||||||
person2 = Person(name='Tommy')
|
person2 = Person(name='Tommy')
|
||||||
person2.member_of.add(Membership(org, person2, id='acme-1'))
|
person2.member_of.add(Membership(org, person2, id='acme-1'))
|
||||||
db.session.add(person2)
|
db.session.add(person2)
|
||||||
with pytest.raises(UniqueViolation) as e:
|
with pytest.raises(DBError) as e:
|
||||||
db.session.flush()
|
db.session.flush()
|
||||||
assert 'One member id per organization' in str(e)
|
assert 'One member id per organization' in str(e)
|
||||||
|
|
||||||
|
|
|
@ -574,8 +574,9 @@ def test_networking_model(user: UserClient):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
||||||
def test_cooking_mixer():
|
def test_cooking_mixer(user: UserClient):
|
||||||
mixer = d.Mixer(serial_number='foo', model='bar', manufacturer='foobar')
|
mixer = d.Mixer(serial_number='foo', model='bar', manufacturer='foobar',
|
||||||
|
owner_id=user.user['id'])
|
||||||
db.session.add(mixer)
|
db.session.add(mixer)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Reference in New Issue