Esempio n. 1
0
async def test_find_user_by_id_not_found():
    collection = await user_model._get_collection()
    await collection.insert_one(fixtures.user_bson_fixture())

    actual = await user_model.find_user_by_id(
        dto.UserID("00000000000000000000000f"))
    assert actual is None
Esempio n. 2
0
async def test_list_user():
    collection = await user_model._get_collection()
    await collection.insert_one(fixtures.user_bson_fixture())

    actual = await user_model.list_users(dto.UserSummaryFilter(limit=20))

    expected = [fixtures.user_summary_fixture()]
    assert list(actual) == expected
Esempio n. 3
0
async def test_list_user_filter_cursor_invalid_user_id():
    collection = await user_model._get_collection()
    await collection.insert_one(fixtures.user_bson_fixture())

    actual = await user_model.list_users(
        dto.UserSummaryFilter(limit=20, cursor=dto.UserID("1")))

    expected: List[dto.UserSummary] = []
    assert list(actual) == expected
Esempio n. 4
0
def test_from_bson():
    actual = user_model._from_bson(fixtures.user_bson_fixture())

    assert actual == fixtures.user_fixture()