Skip to content

Commit

Permalink
feat: test monitor API information routes client (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamarnesen committed Apr 19, 2024
1 parent df9be9a commit 4b9cc61
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ API Reference

api_reference/core
api_reference/tag
api_reference/testmonitor
api_reference/dataframe
api_reference/spec

Expand Down
13 changes: 13 additions & 0 deletions docs/api_reference/testmonitor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _api_tag_page:

nisystemlink.clients.testmonitor
======================

.. autoclass:: nisystemlink.clients.testmonitor.TestMonitorClient
:exclude-members: __init__

.. automethod:: __init__

.. automodule:: nisystemlink.clients.testmonitor.models
:members:
:imported-members:
3 changes: 3 additions & 0 deletions nisystemlink/clients/testmonitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._test_monitor_client import TestMonitorClient

# flake8: noqa
28 changes: 28 additions & 0 deletions nisystemlink/clients/testmonitor/_test_monitor_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Implementation of TestMonitor Client"""

from typing import Optional

from nisystemlink.clients import core
from nisystemlink.clients.core._uplink._base_client import BaseClient
from nisystemlink.clients.core._uplink._methods import get

from . import models


class TestMonitorClient(BaseClient):
def __init__(self, configuration: Optional[core.HttpConfiguration]):
if configuration is None:
configuration = core.JupyterHttpConfiguration()
super().__init__(configuration, base_path="/nitestmonitor/v2/")

@get("")
def api_info(self) -> models.ApiInfo:
"""Get information about the available API operations.
Returns:
Information about available API operations.
Raises:
ApiException: if unable to communicate with the `nitestmonitor` service.
"""
...
3 changes: 3 additions & 0 deletions nisystemlink/clients/testmonitor/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._api_info import Operation, V2Operations, ApiInfo

# flake8: noqa
72 changes: 72 additions & 0 deletions nisystemlink/clients/testmonitor/models/_api_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from nisystemlink.clients.core._api_info import Operation
from nisystemlink.clients.core._uplink._json_model import JsonModel


class V2Operations(JsonModel):
"""The operations available in the routes provided by the v2 HTTP API."""

get_products: Operation
"""The ability to get a list of products."""

query_products: Operation
"""The ability to query products based on their properties."""

create_products: Operation
"""The ability to create one or more products."""

update_products: Operation
"""The ability to update the properties of one or more products."""

delete_products: Operation
"""The ability to delete a single products."""

delete_many_products: Operation
"""The ability to delete a list of products."""

get_results: Operation
"""The ability to get a list of results."""

get_results_property_keys: Operation
"""The ability to get custom property keys."""

query_results: Operation
""""The ability to to query results based on their properties."""

create_results: Operation
"""The ability to create results."""

update_results: Operation
"""The ability to update results."""

delete_result: Operation
"""The ability to delete a single results."""

delete_many_results: Operation
"""The ability to delete multiple results."""

get_steps: Operation
"""The ability to get a list of steps."""

query_steps: Operation
"""The ability to query steps based on their properties."""

create_steps: Operation
"""The ability to create steps."""

update_steps: Operation
"""The ability to update steps."""

delete_step: Operation
"""The ability to delete a single step."""

delete_many_steps: Operation
"""The ability to delete multiple steps."""

query_paths: Operation
"""The ability to query step paths."""


class ApiInfo(JsonModel):
"""Information about the available API operations."""

operations: V2Operations
1 change: 1 addition & 0 deletions tests/integration/testmonitor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# flake8: noqa
17 changes: 17 additions & 0 deletions tests/integration/testmonitor/test_products.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from nisystemlink.clients.core._http_configuration import HttpConfiguration
from nisystemlink.clients.testmonitor import TestMonitorClient


@pytest.fixture(scope="class")
def client(enterprise_config: HttpConfiguration) -> TestMonitorClient:
"""Fixture to create a TestMonitorClient instance."""
return TestMonitorClient(enterprise_config)


@pytest.mark.integration
@pytest.mark.enterprise
class TestTestMonitor:
def test__api_info__returns(self, client: TestMonitorClient):
response = client.api_info()
assert len(response.dict()) != 0

0 comments on commit 4b9cc61

Please sign in to comment.