Skip to content

Commit b5a6e0e

Browse files
author
Martin Kudlej
committed
add annotation tests
1 parent 5edccc5 commit b5a6e0e

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

tests/integration/conftest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def api(
9494

9595
@pytest.fixture(scope="session")
9696
def api_origin(
97-
url: str, token: str, ssl_verify: bool, ocp_provider_ref: str
98-
) -> threescale_api.ThreeScaleClient:
97+
url: str, token: str, ssl_verify: bool) -> threescale_api.ThreeScaleClient:
9998
return threescale_api.ThreeScaleClient(url=url, token=token, ssl_verify=ssl_verify)
10099

101100

@@ -111,6 +110,16 @@ def master_api(
111110
)
112111

113112

113+
@pytest.fixture(scope="session")
114+
def master_api_origin(
115+
master_url: str, master_token: str, ssl_verify: bool) -> threescale_api.ThreeScaleClient:
116+
return threescale_api.ThreeScaleClient(
117+
url=master_url,
118+
token=master_token,
119+
ssl_verify=ssl_verify,
120+
)
121+
122+
114123
@pytest.fixture(scope="module")
115124
def apicast_http_client(application, proxy, ssl_verify):
116125
proxy.deploy()

tests/integration/test_integration_backends.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ def test_backend_metrics_list(backend, backend_metric):
5252

5353
def test_backend_mapping_rules_list(backend, backend_mapping_rule):
5454
assert backend.mapping_rules.list()
55+
56+
57+
def test_backend_annotation(backend, api_origin):
58+
backend_origin = api_origin.backends.fetch(backend.entity_id)
59+
assert backend_origin['annotations']['managed_by'] == 'operator'

tests/integration/test_integration_custom_tenant.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ def test_tenant_can_be_updated(api, custom_tenant):
4747

4848

4949
# end of tests important for CRD - CRU + list
50+
51+
52+
def test_tenant_annotation(custom_tenant, master_api_origin):
53+
tenant_origin = master_api_origin.tenants.read(custom_tenant.entity_id)
54+
assert tenant_origin["signup"]["account"]["annotations"]["managed_by"] == "operator"

tests/integration/test_integration_openapis.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,12 @@ def test_openapi_can_be_updated(api, openapi):
3333

3434

3535
# end of tests important for CRD - CRU + list
36+
37+
38+
def test_openapi_annotation(openapi, api_origin):
39+
service_origin = api_origin.services.fetch(openapi.service.entity_id)
40+
assert service_origin['annotations']['managed_by'] == 'operator'
41+
42+
for backend in openapi.backends:
43+
backend_origin = api_origin.backends.fetch(backend.entity_id)
44+
assert backend_origin['annotations']['managed_by'] == 'operator'

tests/integration/test_integration_services.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,8 @@ def test_service_active_docs(service, active_doc):
145145
assert all(
146146
[acs["service_id"] == service["id"] for acs in service.active_docs.list()]
147147
)
148+
149+
150+
def test_service_annotation(service, api_origin):
151+
service_origin = api_origin.services.fetch(service.entity_id)
152+
assert service_origin['annotations']['managed_by'] == 'operator'

0 commit comments

Comments
 (0)