Skip to content

Commit

Permalink
BE-1585 add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasha Syvyuk authored and Dasha Syvyuk committed Jul 29, 2021
1 parent cda4a3b commit d69f2bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions livestyled/schemas/tests/fixtures/example_user_email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": "/v4/contexts/UserEmail",
"@id": "/v4/user_emails/2",
"@type": "UserEmail",
"id": 2,
"email": "test@test.com",
"valid": true
}
13 changes: 12 additions & 1 deletion livestyled/schemas/tests/test_users.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime, timedelta, timezone
import os

from livestyled.schemas.user import UserSchema
from livestyled.schemas.user import UserEmailSchema, UserSchema


FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixtures')
Expand Down Expand Up @@ -74,3 +74,14 @@ def test_deserialize_user():
}
],
}


def test_deserialize_user_email():
with open(os.path.join(FIXTURES_DIR, 'example_user_email.json'), 'r') as fixture_file:
user_email = fixture_file.read()
deserialized_user_email = UserEmailSchema().loads(user_email)
assert deserialized_user_email == {
'id': 2,
'email': 'test@test.com',
'valid': True
}

0 comments on commit d69f2bb

Please sign in to comment.