コード例 #1
0
def test_registered_user_knows_its_permissions():
    registered = make_registered_user(
        permissions=[Permission.lookup_isni.value])
    assert_that(registered.has_permission(Permission.lookup_isni), is_(True),
                "isni lookup?")
    assert_that(registered.has_permission(Permission.assign_isni), is_(False),
                "isni assign?")
コード例 #2
0
def tests_overwrites_user_data_on_store(store):
    store.store_user(make_registered_user(email="*****@*****.**", api_key="token", permissions=["isni.lookup"]))
    store.store_user(make_anonymous_user())

    overwritten_user = store.load_user()

    assert_that(overwritten_user, user_with(email=None, api_key=None, permissions=empty()), "overwritten user")
コード例 #3
0
def tests_removes_user_credentials_from_settings_store_on_sign_out(store):
    store.should_receive("load_user").and_return(make_registered_user(email="*****@*****.**",
                                                                      api_key="token",
                                                                      permissions=("isni.lookup", "isni.assign")))
    session = load_session_from(store)

    store.should_receive("remove_user").once()
    session.logout()
コード例 #4
0
def tests_loads_user_information_from_settings_store_and_logs_user_in(store):
    store.should_receive("load_user").and_return(make_registered_user(email="*****@*****.**",
                                                                      api_key="token",
                                                                      permissions=("isni.lookup", "isni.assign")))
    session = load_session_from(store)

    assert_that(session.current_user, has_properties(email="*****@*****.**",
                                                     api_key="token",
                                                     permissions=contains("isni.lookup", "isni.assign")))
コード例 #5
0
def tests_overwrites_user_data_on_store(store):
    store.store_user(
        make_registered_user(email="*****@*****.**",
                             api_key="token",
                             permissions=["isni.lookup"]))
    store.store_user(make_anonymous_user())

    overwritten_user = store.load_user()

    assert_that(overwritten_user,
                user_with(email=None, api_key=None, permissions=empty()),
                "overwritten user")
コード例 #6
0
def tests_round_trips_user_to_settings_file(store):
    store.store_user(
        make_registered_user(email="*****@*****.**",
                             api_key="token",
                             permissions=["isni.lookup"]))

    persisted_user = store.load_user()

    assert_that(
        persisted_user,
        user_with(email="*****@*****.**",
                  api_key="token",
                  permissions=["isni.lookup"]))
コード例 #7
0
ファイル: test_user.py プロジェクト: Iconoclasteinc/tgit
def test_registered_user_knows_its_permissions():
    registered = make_registered_user(permissions=[Permission.lookup_isni.value])
    assert_that(registered.has_permission(Permission.lookup_isni), is_(True), "isni lookup?")
    assert_that(registered.has_permission(Permission.assign_isni), is_(False), "isni assign?")
コード例 #8
0
ファイル: test_user.py プロジェクト: Iconoclasteinc/tgit
def test_registered_user_knows_its_api_key():
    registered = make_registered_user(api_key="0123456789")
    assert_that(registered.api_key, is_("0123456789"), "registered api key")
コード例 #9
0
ファイル: test_user.py プロジェクト: Iconoclasteinc/tgit
def test_registered_user_knows_its_email():
    registered = make_registered_user(email="*****@*****.**")
    assert_that(registered.email, is_("*****@*****.**"), "registered email")
コード例 #10
0
ファイル: test_user.py プロジェクト: Iconoclasteinc/tgit
def test_registered_user_has_permission_to_lookup_isni():
    registered = make_registered_user()
    assert_that(registered.has_permission(Permission.lookup_isni), is_(True), "grant to registered")
コード例 #11
0
def test_registered_user_knows_its_api_key():
    registered = make_registered_user(api_key="0123456789")
    assert_that(registered.api_key, is_("0123456789"), "registered api key")
コード例 #12
0
def test_registered_user_knows_its_email():
    registered = make_registered_user(email="*****@*****.**")
    assert_that(registered.email, is_("*****@*****.**"), "registered email")
コード例 #13
0
def test_registered_user_has_permission_to_lookup_isni():
    registered = make_registered_user()
    assert_that(registered.has_permission(Permission.lookup_isni), is_(True),
                "grant to registered")
コード例 #14
0
def tests_round_trips_user_to_settings_file(store):
    store.store_user(make_registered_user(email="*****@*****.**", api_key="token", permissions=["isni.lookup"]))

    persisted_user = store.load_user()

    assert_that(persisted_user, user_with(email="*****@*****.**", api_key="token", permissions=["isni.lookup"]))