Skip to content

Manual Integration Tests for Registry

Nick Ballenger edited this page May 26, 2021 · 1 revision

When deploying the Library Registry some manual integration testing is recommended.

1. Check /libraries and /libraries/qa

For the registry server you're testing, you'll want to make requests to both /libraries and /libraries/qa, to ensure that it is producing sensible results for both production and non-production stage libraries. For instance, for the registry server at http://qa-libraryregistry.librarysimplified.org, you would want to look at the output of:

  • http://qa-libraryregistry.librarysimplified.org/libraries
  • http://qa-libraryregistry.librarysimplified.org/libraries/qa

In both cases the output should be a JSON formatted OPDS document similar to the following (the ellipses indicate truncated sections):

{
  "metadata": {
    "title": "Libraries",
    "adobe_vendor_id": "NYPL"
  },
  "catalogs": [
    {
      "metadata": {
        "id": "urn:uuid:84340c25-8758-4f43-8670-1bc3a99f6098",
        "title": "LYRASIS",
        "modified": "2020-09-10T14:27:04Z",
        "updated": "2020-09-10T14:27:04Z",
        "schema:distance": "162 km.",
        "distance": "162 km.",
        "description": "The library of the LYRASIS organization."
      },
      "links": [
        {
          "rel": "http://opds-spec.org/catalog",
          "href": "https://demo.lyrasistechnology.org/lyrasis/",
          "type": "application/atom+xml;profile=opds-catalog;kind=acquisition"
        },

        {"...":"..."},

      ]
    },
    
    {"...":"..."},

    {
      "metadata": {
        "id": "urn:uuid:de403f02-9c7b-42aa-86e6-b3317b18099b",
        "title": "Yolo County Library",
        "modified": "2020-01-10T16:14:40Z",
        "updated": "2020-01-10T16:14:40Z",
        "description": "We connect people and ideas"
      },
      "links": [
        {
          "rel": "http://opds-spec.org/catalog",
          "href": "http://califa111.simplye-ca.org/CAYOLO/",
          "type": "application/atom+xml;profile=opds-catalog;kind=acquisition"
        },

        {"...":"..."},

      ]
    }
  ],
  "links": [
    {
      "rel": "self",
      "href": "http://qa-libraryregistry.librarysimplified.org/libraries",
      "type": "application/opds+json"
    },

    {"...":"..."},

  ]
}

2. Test the Adobe ID Integration

This is a bit more involved, but is extremely important since without a working Adobe integration patrons won't be able to complete the log in process.

To test the Adobe integration you will need:

  • Library credentials: a valid ID and pin
  • Access to a checkout of the circulation repository
  • A working Python 3.6+ environment
  • Installed versions of the Python packages click and requests

2a: Retrieve a DRM clientToken

You will need to make a request using your ID and pin, to the /patrons/me endpoint of a circulation server which recognizes that ID/pin. If your ID were 12345678901234, your pin were 1234, and your credentials were valid on librarysimplified.org, you could request the following URL:

https://12345678901234:[email protected]/patrons/me

and the response would look like:

{
  "simplified:authorization_identifier": "12345678901234",
  "drm": [
    {
      "drm:vendor": "NYPL",
      "drm:scheme": "http://librarysimplified.org/terms/drm/scheme/ACS",
      "drm:clientToken": "NYNYPL|1621462513|3e0d6602-2446-4f1a-bcad-4e68bcffdfc1|xzu4JDv93sjAEzx1sSIxyWrXn;zXD62;vsR:LT1y8M0@"
    }
  ],
  "links": [
    {
      "href": "https://circulation.librarysimplified.org/NYNYPL/AdobeAuth/devices",
      "rel": "http://librarysimplified.org/terms/drm/rel/devices"
    },
    {
      "href": "https://circulation.librarysimplified.org/NYNYPL/annotations/",
      "type": "application/ld+json; profile=\"http://www.w3.org/ns/anno.jsonld\"",
      "rel": "http://www.w3.org/ns/oa#annotationService"
    }
  ],
  "simplified:authorization_expires": "2021-06-30T00:00:00Z",
  "settings": {
    "simplified:synchronize_annotations": null
  }
}

From that, you would need to copy out the value of drm:clientToken, which is:

"NYNYPL|1621462513|3e0d6602-2446-4f1a-bcad-4e68bcffdfc1|xzu4JDv93sjAEzx1sSIxyWrXn;zXD62;vsR:LT1y8M0@"

If you have curl and jq available on your system, you can get the output from a single pipeline (subbing in your barcode and pin):

curl -s https://12345678901234:[email protected]/patrons/me | jq '.drm' | jq '.[0]' | jq '.["drm:clientToken"]'

2b: Test the Adobe Sign In loop

Once you have a client token, you can use the script adobe-id-for-short-client-token, which is in the circulation repository. Assuming you have Python 3.6+ and the requests and click packages installed, that would look like the following:

❯ cd /path/to/circulation/repo
❯ ./bin/informational/adobe-id-for-short-client-token \
> --registry-url=http://qa-libraryregistry.librarysimplified.org \
> "NYNYPL|1622069282|66dfc331-4396-4d68-95f1-e02ae4806f64|kzowgSNawd32:iCqETw46k8HFLED6zZ72iKMQCHiFc@"

The supplied Short Client Token was well formed, and decomposes to:

  Library code:      NYNYPL
  Timestamp:         1622069282
  Patron identifier: 66dfc331-4396-4d68-95f1-e02ae4806f64
  Signature:         rkzowgSNawd32:iCqETw46k8HFLED6zZ72iKMQCHiFc@


Requesting http://qa-libraryregistry.librarysimplified.org/AdobeAuth/SignIn with payload:

    <signInRequest method="standard" xmlns="http://ns.adobe.com/adept">
        <username>NYNYPL|1622069282|66dfc331-4396-4d68-95f1-e02ae4806f64</username>
        <password>rkzowgSNawd32:iCqETw46k8HFLED6zZ72iKMQCHiFc@</password>
    </signInRequest>

Registry server responded with:

    <signInResponse xmlns="http://ns.adobe.com/adept">
        <user>urn:uuid:71ada8b0-fcc4-411d-861b-76bb5a9dda28</user>
        <label>Delegated account ID urn:uuid:71ada8b0-fcc4-411d-861b-76bb5a9dda28</label>
    </signInResponse>

SUCCESS Adobe ID for this patron is urn:uuid:71ada8b0-fcc4-411d-861b-76bb5a9dda28 SUCCESS

3. Test the Registry's Admin Interface

For the registry server under test, go to the /admin/ URL, and make sure you can:

  • Log in successfully
  • View the various tabs and interfaces
  • Log out successfully

4. Test the Circulation Manager as a Registry Client

Instances of the Circulation manager need to be able to use the Registry as a 'Discovery' service. To test that:

  1. Log into the admin interface for a running instance of the circulation manager
  2. Go to 'Discovery' > 'Discovery service configuration'
  3. Add your target Registry instance as a Discovery service and save
  4. Lower down the page, choose a Library
  5. For both the testing and production stages, update that Library's registration
  6. Use a real email address where you can receive messages
  7. If this is the first registration of a Library with a particular Registry, you should receive confirmation emails
  8. Make sure those confirmation emails arrive and are usable
Clone this wiki locally