From f4597861743228d3d153a9440b6216ef37164549 Mon Sep 17 00:00:00 2001 From: Martin Pentrak Date: Tue, 8 Oct 2024 14:44:32 +0200 Subject: [PATCH] done /adim/api/active_docs/{id}.json --- tests/integration/conftest.py | 16 ++++++++++++++ .../test_integration_activedocs.py | 22 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 9e24c33..4db7474 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -427,6 +427,22 @@ def tenant_params(): email="email@invalid.invalid", org_name="org") + +@pytest.fixture(scope='module') +def active_docs_update_body(): + return """ + {"swagger":"2.0","info":{"version":"1.0.1","title":"Test"},"paths":{"/test":{"get":{"operationId":"Test", + "parameters":[],"responses":{"400":{"description":"bad input parameters"}}}}},"definitions":{}} + """ + + +@pytest.fixture(scope='module') +def active_docs_update_params(active_docs_update_body): + suffix = get_suffix() + name = f"updated-{suffix}" + return dict(name=name, body=active_docs_update_body) + + @pytest.fixture(scope='module') def active_docs_body(): return """ diff --git a/tests/integration/test_integration_activedocs.py b/tests/integration/test_integration_activedocs.py index 7ef574d..0b9a0f7 100644 --- a/tests/integration/test_integration_activedocs.py +++ b/tests/integration/test_integration_activedocs.py @@ -1,7 +1,29 @@ +from unittest import skipIf + +import pytest + from tests.integration import asserts from .asserts import assert_resource, assert_resource_params +from .conftest import active_docs_params, get_suffix + + +def test_active_docs_can_be_created(active_doc, active_docs_params): + asserts.assert_resource(active_doc) + asserts.assert_resource_params(active_doc, active_docs_params) + def test_active_docs_fetch(active_doc): ac = active_doc.client.fetch(int(active_doc['id'])) assert ac assert ac['id'] == active_doc['id'] + + +def test_active_docs_list(api, active_doc): + active_docs = api.active_docs.list() + assert len(active_docs) >= 1 + + +def test_active_docs_update(active_doc, active_docs_update_params): + updated_active_doc = active_doc.update(params=active_docs_update_params) + asserts.assert_resource(updated_active_doc) + asserts.assert_resource_params(updated_active_doc, active_docs_update_params)