示例#1
0
def test_returns_array_of_identities(cheddar, platform):
    platform.allowed_bearer_token = "token"
    platform.identities_for_lookup["jo mil"] = [{
        "id":
        "0000000123456789",
        "type":
        "individual",
        "firstName":
        "Joel",
        "lastName":
        "Miller",
        "dateOfBirth":
        "1969",
        "dateOfDeath":
        "",
        "works": [{
            "title": "Chevere!"
        }]
    }]

    identities = wait_for_completion(cheddar.get_identities("jo mil", "token"))
    assert_that(
        identities,
        has_entry(
            "identities",
            contains(
                has_entries(id="0000000123456789",
                            firstName="Joel",
                            lastName="Miller",
                            dateOfBirth="1969",
                            dateOfDeath="",
                            works=contains(has_entries(title="Chevere!"))))))
示例#2
0
def test_returns_hit_count(cheddar, platform):
    platform.allowed_bearer_token = "token"
    platform.identities_for_lookup["reb an mal"] = [{
        "id": "0000000115677274",
        "type": "individual"
    }, {
        "id": "0000000123456789",
        "type": "individual"
    }]

    identities = wait_for_completion(cheddar.get_identities("reb an mal", "token"))
    assert_that(identities["total_count"], equal_to("2"), "The total amount of results")
示例#3
0
def test_returns_hit_count(cheddar, platform):
    platform.allowed_bearer_token = "token"
    platform.identities_for_lookup["reb an mal"] = [{
        "id": "0000000115677274",
        "type": "individual"
    }, {
        "id": "0000000123456789",
        "type": "individual"
    }]

    identities = wait_for_completion(
        cheddar.get_identities("reb an mal", "token"))
    assert_that(identities["total_count"], equal_to("2"),
                "The total amount of results")
示例#4
0
def test_returns_array_of_identities(cheddar, platform):
    platform.allowed_bearer_token = "token"
    platform.identities_for_lookup["jo mil"] = [{
        "id": "0000000123456789",
        "type": "individual",
        "firstName": "Joel",
        "lastName": "Miller",
        "dateOfBirth": "1969",
        "dateOfDeath": "",
        "works": [
            {"title": "Chevere!"}
        ]
    }]

    identities = wait_for_completion(cheddar.get_identities("jo mil", "token"))
    assert_that(identities, has_entry("identities",
                                      contains(has_entries(id="0000000123456789",
                                                           firstName="Joel",
                                                           lastName="Miller",
                                                           dateOfBirth="1969",
                                                           dateOfDeath="",
                                                           works=contains(has_entries(title="Chevere!"))))))
示例#5
0
def test_returns_empty_array_of_identities(cheddar, platform):
    platform.allowed_bearer_token = "token"
    identities = wait_for_completion(cheddar.get_identities("reb an mal", "token"))
    assert_that(identities, has_entry("identities", empty()), "The identities")
示例#6
0
def test_raises_insufficient_information_error_when_getting_identities(cheddar, platform):
    platform.response_code_queue = [422]
    platform.allowed_bearer_token = "token"
    with pytest.raises(InsufficientInformationError):
        wait_for_completion(cheddar.get_identities("...", "token"))
示例#7
0
def test_raises_system_error_when_getting_identities(cheddar, platform):
    platform.response_code_queue = [503]
    platform.allowed_bearer_token = "token"
    with pytest.raises(PlatformConnectionError):
        wait_for_completion(cheddar.get_identities("...", "token"))
示例#8
0
def test_raises_unauthorized_when_getting_identities_and_not_signed_in(cheddar, platform):
    platform.allowed_bearer_token = "token"
    with pytest.raises(AuthenticationError):
        wait_for_completion(cheddar.get_identities("reb an mal", "..."))
示例#9
0
def test_raises_permission_denied_error_on_402(cheddar, platform):
    platform.response_code_queue = [402]
    platform.allowed_bearer_token = "token"
    with pytest.raises(PermissionDeniedError):
        wait_for_completion(cheddar.get_identities("...", "token"))
示例#10
0
def test_returns_empty_array_of_identities(cheddar, platform):
    platform.allowed_bearer_token = "token"
    identities = wait_for_completion(
        cheddar.get_identities("reb an mal", "token"))
    assert_that(identities, has_entry("identities", empty()), "The identities")
示例#11
0
def test_raises_insufficient_information_error_when_getting_identities(
        cheddar, platform):
    platform.response_code_queue = [422]
    platform.allowed_bearer_token = "token"
    with pytest.raises(InsufficientInformationError):
        wait_for_completion(cheddar.get_identities("...", "token"))
示例#12
0
def test_raises_system_error_when_getting_identities(cheddar, platform):
    platform.response_code_queue = [503]
    platform.allowed_bearer_token = "token"
    with pytest.raises(PlatformConnectionError):
        wait_for_completion(cheddar.get_identities("...", "token"))
示例#13
0
def test_raises_unauthorized_when_getting_identities_and_not_signed_in(
        cheddar, platform):
    platform.allowed_bearer_token = "token"
    with pytest.raises(AuthenticationError):
        wait_for_completion(cheddar.get_identities("reb an mal", "..."))
示例#14
0
def test_raises_permission_denied_error_on_402(cheddar, platform):
    platform.response_code_queue = [402]
    platform.allowed_bearer_token = "token"
    with pytest.raises(PermissionDeniedError):
        wait_for_completion(cheddar.get_identities("...", "token"))