forked from 3scale-qe/3scale-api-python-crd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_integration_openapis.py
More file actions
44 lines (29 loc) · 1.37 KB
/
Copy pathtest_integration_openapis.py
File metadata and controls
44 lines (29 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import json
from tests.integration import asserts
from .asserts import assert_resource, assert_resource_params
# tests important for CRD - CRU + list
def test_openapis_list(api, openapi):
openapis = api.openapis.list()
assert len(openapis) >= 1
def test_openapi_can_be_created(api, openapi_params, openapi):
assert_resource(openapi)
assert_resource_params(openapi, openapi_params)
def test_openapi_can_be_read(api, openapi_params, openapi):
read = api.openapis.read(openapi.entity_id)
asserts.assert_resource(read)
asserts.assert_resource_params(read, openapi_params)
def test_openapi_can_be_updated(api, openapi):
des_changed = (openapi["productSystemName"] or "") + "_changed"
openapi["productSystemName"] = des_changed
openapi.update()
assert openapi["productSystemName"] == des_changed
updated = openapi.read()
assert updated["productSystemName"] == des_changed
assert openapi["productSystemName"] == des_changed
# 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'