Esempio n. 1
0
def test_set_status(user_store: UserStore):
    user_store.add_user(username="******", status=UserStatus.read_only)

    user: StoredUser = user_store.find_by_username("one")
    assert user.username == "one"
    assert user.status == UserStatus.read_only
    assert user.status.can_read
    assert not user.status.can_write

    user_store.set_status(username="******", status=UserStatus.read_write)

    user: StoredUser = user_store.find_by_username("one")
    assert user.status.can_write
Esempio n. 2
0
def test_add_user(user_store: UserStore):
    password = user_store.add_user(
        username="******", status=UserStatus.read_write
    )
    assert len(password) > 15 and 3 == password.count("-")

    user: StoredUser = user_store.find_by_username("one")
    assert user.username == "one"
    assert isinstance(user.uuid, str) and len(user.uuid) == 36
    assert user.hashed_password is not None
    assert user.status == UserStatus.read_write
    assert user.status.can_read
    assert user.status.can_write