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!"))))))
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")
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")
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!"))))))
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")
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"))
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"))
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", "..."))
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"))
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")
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"))
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", "..."))