Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ def api(

@pytest.fixture(scope="session")
def api_origin(
url: str, token: str, ssl_verify: bool, ocp_provider_ref: str
) -> threescale_api.ThreeScaleClient:
url: str, token: str, ssl_verify: bool) -> threescale_api.ThreeScaleClient:
return threescale_api.ThreeScaleClient(url=url, token=token, ssl_verify=ssl_verify)


Expand All @@ -111,6 +110,16 @@ def master_api(
)


@pytest.fixture(scope="session")
def master_api_origin(
master_url: str, master_token: str, ssl_verify: bool) -> threescale_api.ThreeScaleClient:
return threescale_api.ThreeScaleClient(
url=master_url,
token=master_token,
ssl_verify=ssl_verify,
)


@pytest.fixture(scope="module")
def apicast_http_client(application, proxy, ssl_verify):
proxy.deploy()
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_integration_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ def test_backend_metrics_list(backend, backend_metric):

def test_backend_mapping_rules_list(backend, backend_mapping_rule):
assert backend.mapping_rules.list()


def test_backend_annotation(backend, api_origin):
backend_origin = api_origin.backends.fetch(backend.entity_id)
assert backend_origin['annotations']['managed_by'] == 'operator'
5 changes: 5 additions & 0 deletions tests/integration/test_integration_custom_tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ def test_tenant_can_be_updated(api, custom_tenant):


# end of tests important for CRD - CRU + list


def test_tenant_annotation(custom_tenant, master_api_origin):
tenant_origin = master_api_origin.tenants.read(custom_tenant.entity_id)
assert tenant_origin["signup"]["account"]["annotations"]["managed_by"] == "operator"
9 changes: 9 additions & 0 deletions tests/integration/test_integration_openapis.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ def test_openapi_can_be_updated(api, openapi):


# end of tests important for CRD - CRU + list


def test_openapi_annotation(openapi, api_origin):
service_origin = api_origin.services.fetch(openapi.service.entity_id)
assert service_origin['annotations']['managed_by'] == 'operator'

for backend in openapi.backends:
backend_origin = api_origin.backends.fetch(backend.entity_id)
assert backend_origin['annotations']['managed_by'] == 'operator'
5 changes: 5 additions & 0 deletions tests/integration/test_integration_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ def test_service_active_docs(service, active_doc):
assert all(
[acs["service_id"] == service["id"] for acs in service.active_docs.list()]
)


def test_service_annotation(service, api_origin):
service_origin = api_origin.services.fetch(service.entity_id)
assert service_origin['annotations']['managed_by'] == 'operator'
8 changes: 4 additions & 4 deletions threescale_api_crd/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3212,10 +3212,10 @@ def __init__(self, entity_name="system_name", **kwargs):

self.entity_id = entity["id"]
super().__init__(crd=crd, entity=entity, entity_name=entity_name, **kwargs)

# this is not here because of some backup, but because we need to have option
# to creater empty object without any data. This is related to "lazy load"
super().__init__(entity_name=entity_name, **kwargs)
else:
# this is not here because of some backup, but because we need to have option
# to creater empty object without any data. This is related to "lazy load"
super().__init__(entity_name=entity_name, **kwargs)

@property
def metric(self) -> "Metric":
Expand Down