-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_external_id_impl.py
More file actions
41 lines (31 loc) · 1.15 KB
/
test_external_id_impl.py
File metadata and controls
41 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import unittest
from shared.database_gen.sqlacodegen_models import Externalid
from shared.db_models.external_id_impl import ExternalIdImpl
external_id_orm = Externalid(
feed_id="feed_id",
associated_id="associated_id",
source="source",
)
expected_external_id = ExternalIdImpl(
external_id="associated_id",
source="source",
)
class TestExternalIdImpl(unittest.TestCase):
"""Test the `ExternalIdImpl` model."""
def test_external_id_impl(self):
assert ExternalIdImpl.from_orm(external_id_orm) == expected_external_id
def test_external_id_impl_none_empty(self):
"""Test the `from_orm` method with empty and none value fields."""
external_id_orm_empty = Externalid(
feed_id="feed_id",
associated_id="",
source=None,
)
expected_external_id_empty = ExternalIdImpl(
external_id="",
source=None,
)
assert ExternalIdImpl.from_orm(external_id_orm_empty) == expected_external_id_empty
def test_external_id_impl_none(self):
"""Test the `from_orm` method with None."""
assert ExternalIdImpl.from_orm(None) is None