Skip to content

Fix redirect + content validation logic for Application checks #156

@nezlobnaya

Description

@nezlobnaya

When an application defines both expected_location and expected_content, the current logic in GetStatus() bypasses validation of the original response and fetches the redirect target directly.
This causes the test to validate the wrong response (target instead of source) and fails on relative expected_location values (e.g., mng/login → unsupported protocol scheme "").

Steps to Reproduce

Add this entry to config/applications.yml:

 name: primo-ve-search
  url: "https://search.library.nyu.edu/"
  expected_status: 302
  expected_location: "mng/login"
  expected_content: "Log into your account"

Run:

docker compose run aswa primo-ve-search

Observe the output:

Error performing request: Get "mng/login": unsupported protocol scheme ""

or, if the URL is made absolute, the test compares status=302 and location=/discovery/... from the wrong response.

Expected Behavior:

The test should:

Perform a request to the original URL (https://search.library.nyu.edu/) with redirects disabled.

Validate expected_status and expected_location against that original response.

If expected_content is defined, follow to the resolved target (e.g., /mng/login or /discovery/...) and verify that the content matches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions