Skip to content

Rewrite Mock to handle known authorities #43

@mbklein

Description

@mbklein

Description

Authoritex.Mock has no way to know whether a given unregistered URI is from an unknown authority or a missing ID from a known authority.

Current Implementation

Per #42, Authoritex.Mock.search("missing_id_authority:whatever") will return {:error, 404}, while any other unregistered URI will return {:error, :unknown_authority}

Proposed Implementation

  • Update Authoritex.Mock.set_data() to include a list of known authority prefixes along with the map of IDs and labels
  • Update Authoritex.Mock.fetch() to check the given URI against the list of registered authority prefixes (using String.starts_with? is sufficient)
    • If at least one authority prefix matches and the ID is registered, return the result as usual
    • If at least one authority prefix matches but the ID isn't found, the result is {:error, 404}
    • If no authority prefix matches even if the ID is found, the result is {:error, :unknown_authority}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions