Cleaned up as_dict/asdict, issue #144, #188

This commit is contained in:
Rhet Turnbull
2020-10-27 06:54:42 -07:00
parent 091f1d9bb4
commit 603dabb8f4
12 changed files with 94 additions and 34 deletions

View File

@@ -53,6 +53,23 @@ LIKE_UUID_DICT = {
],
}
COMMENT_UUID_ASDICT = {
"4E4944A0-3E5C-4028-9600-A8709F2FA1DB": {
"datetime": datetime.datetime(2020, 9, 19, 22, 54, 12, 947978),
"user": None,
"ismine": True,
"text": "Nice trophy",
}
}
LIKE_UUID_ASDICT = {
"65BADBD7-A50C-4956-96BA-1BB61155DA17": {
"datetime": datetime.datetime(2020, 9, 18, 10, 28, 52, 570000),
"user": None,
"ismine": False,
}
}
@pytest.fixture(scope="module")
def photosdb():
@@ -69,3 +86,15 @@ def test_likes(photosdb):
for uuid in LIKE_UUID_DICT:
photo = photosdb.get_photo(uuid)
assert photo.likes == LIKE_UUID_DICT[uuid]
def test_comments_as_dict(photosdb):
for uuid in COMMENT_UUID_ASDICT:
photo = photosdb.get_photo(uuid)
assert photo.comments[0].asdict() == COMMENT_UUID_ASDICT[uuid]
def test_likes_as_dict(photosdb):
for uuid in LIKE_UUID_ASDICT:
photo = photosdb.get_photo(uuid)
assert photo.likes[0].asdict() == LIKE_UUID_ASDICT[uuid]