-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
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 (usingString.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}