Skip to content

BUG: Fix test and related logic for test_get_detailed_service #2335

Open
@MackHalliday

Description

@MackHalliday

Description

While updating testing for ticket #1682, an issue was found in tests/app/service/test_rest.py and related logic. The failure appears to be due to a flaw in the code rather than the test itself. This user story is for identifying the root cause, fixing the logic, and updating the test as needed.

  • The feature impacted feature is GET /service/<service-id>/?detailed=True&today_only=<boolean> endpoint

  • The test impacted is tests/app/service/test_rest.py.

  • Ticket is understood, and QA has been contacted (if the ticket has a QA label).

  • This work is added to the sprint review slide deck (key win bullet point and demo slide)

Steps to Reproduce

  1. Unskip test test_get_detailed_service in the tests/app/service/test_rest.py file.
  2. Note the different expected return values for the endpoint /service/<service-id>/?detailed=True&today_only=<boolean>

No - The test is skipped for now.

Impact/Urgency

Low - This is only a unit tests, and the related feature does not appear to be frequently used.

Expected Behavior

  • Unknown - The dev working this user story will have to confirm the expected behavior of this feature before updating the code and/or test.

QA Considerations

  • Work with the DEV to confirm expected behavior /service/<service-id>/?detailed=True&today_only=<boolean> and edgecases
  • Put these query params under automation

Additional Info & Resources

The response from this route contains a subset of data similar to that of the /service/<service-id>/statistics route. It might be a good idea to ensure that whatever logic is bad with the routes described in this ticket does not also affect this route.

Present behavior (service is the QA Automation service)
GET /service/<service-id>?detailed=True - note the statistics property that is included

{
    "data": {
        "active": true,
        "consent_to_research": null,
        "contact_link": null,
        "count_as_live": false,
        "created_at": "2023-01-12T16:39:02.237291",
        "crown": null,
        "go_live_at": null,
        "id": "<redacted for this ticket>",
        "name": "VANotify QA Automation",
        "organisation_type": null,
        "p2p_enabled": null,
        "prefix_sms": false,
        "rate_limit": 3000,
        "research_mode": false,
        "restricted": false,
        "sending_domain": null,
        "smtp_user": null,
        "statistics": {
            "email": {
                "delivered": 144,
                "failed": 39,
                "requested": 183
            },
            "letter": {
                "delivered": 0,
                "failed": 0,
                "requested": 0
            },
            "sms": {
                "delivered": 190,
                "failed": 40,
                "requested": 237
            }
        },
        "updated_at": "2024-02-09T17:08:32.680383",
        "version": 4,
        "volume_email": null,
        "volume_letter": null,
        "volume_sms": null
    }
}

GET /service/<service-id>?detailed=True&today_only=False returns the same statistics property and data as above. What timeframe are these routes fetching?

GET /service/<service-id>?detailed=True&today_only=True returns the same statistics property but just today's stats.

{
    "data": {
        "active": true,
        "consent_to_research": null,
        "contact_link": null,
        "count_as_live": false,
        "created_at": "2023-01-12T16:39:02.237291",
        "crown": null,
        "go_live_at": null,
        "id": "<redacted for this ticket>",
        "name": "VANotify QA Automation",
        "organisation_type": null,
        "p2p_enabled": null,
        "prefix_sms": false,
        "rate_limit": 3000,
        "research_mode": false,
        "restricted": false,
        "sending_domain": null,
        "smtp_user": null,
        "statistics": {
            "email": {
                "delivered": 22,
                "failed": 6,
                "requested": 28
            },
            "letter": {
                "delivered": 0,
                "failed": 0,
                "requested": 0
            },
            "sms": {
                "delivered": 30,
                "failed": 6,
                "requested": 36
            }
        },
        "updated_at": "2024-02-09T17:08:32.680383",
        "version": 4,
        "volume_email": null,
        "volume_letter": null,
        "volume_sms": null
    }
}

Note that the parametrized tests that exist do not, in QA's opinion, cover things very completely.

Note also that these two routes return the same data:
GET /service/ GET /service/<service-id>?detailed=False

Note also the route GET /service/<service-id>/statistics returns the following, which is the data in the statistics property above when ?detailed=True is passed to GET `/service/

{
    "data": {
        "email": {
            "delivered": 144,
            "failed": 39,
            "requested": 183
        },
        "letter": {
            "delivered": 0,
            "failed": 0,
            "requested": 0
        },
        "sms": {
            "delivered": 197,
            "failed": 40,
            "requested": 237
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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