def test_memoize_profile():
    profile_factory = ProfileFactory(PROFILE)
    user = Auth0User({}, profile_factory.create)

    user.profile
    user.profile
    user.ebl_name

    assert profile_factory.count == 1
def user() -> User:
    return Auth0User(
        {
            "scope": [
                "read:words",
                "write:words",
                "transliterate:fragments",
                "lemmatize:fragments",
                "annotate:fragments",
                "read:fragments",
                "read:WGL-folios",
                "read:bibliography",
                "write:bibliography",
                "read:texts",
                "write:texts",
                "create:texts",
            ]
        },
        lambda: {
            "name": "*****@*****.**",
            "https://ebabylon.org/eblName": "User",
        },
    )
Beispiel #3
0
 def user_loader():
     return Auth0User({"scope": scope}, lambda: {})
def test_can_read_folio(scopes, folio_name, expected):
    user = Auth0User({"scope": scopes}, create_default_profile)

    assert user.can_read_folio(folio_name) == expected
def test_ebl_name(profile, expected):
    user = Auth0User({}, ProfileFactory(profile).create)

    assert user.ebl_name == expected
def test_profile():
    user = Auth0User({}, create_default_profile)

    assert user.profile == PROFILE
def test_has_scope():
    scope = "scope"
    user = Auth0User({"scope": scope}, create_default_profile)

    assert user.has_scope(scope) is True
    assert user.has_scope("other:scope") is False