usnistgov / dioptra

Test Software for the Characterization of AI Technologies
https://pages.nist.gov/dioptra/
Other
210 stars 30 forks source link

Integrate the v1 Python client into the integration tests #592

Open keithmanville opened 1 month ago

keithmanville commented 1 month ago

Integrate the new Python client into existing tests, replacing the flask test client.

This will simplify the code for many of the "actions" For example, registering a queue uses the register_queue action:

def register_queue(
    client: FlaskClient,
    name: str,
    description: str,
    group_id: int,
) -> TestResponse:
    """snipped docstrings for brevity"""
    payload = {"name": name, "description": description, "group": group_id}

    return client.post(
        f"/{V1_ROOT}/{V1_QUEUES_ROUTE}/", json=payload, follow_redirects=True,
    )

which is called in the tests like this:

response = actions.register_queue(client, name=name, description="", group_id=group_id)

With the Dioptra client, the register_queue action can be deleted and calls to it can be replaced with calls to the client. For example:

client.queues.create(group_id, name, description)

Definition of done: