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_custom_tenant.py
More file actions
54 lines (36 loc) · 1.91 KB
/
Copy pathtest_integration_custom_tenant.py
File metadata and controls
54 lines (36 loc) · 1.91 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
45
46
47
48
49
50
51
52
53
54
from tests.integration import asserts
from .asserts import assert_resource, assert_resource_params
def test_3scale_master_url_is_set(master_api, master_url, master_token):
assert master_url
assert master_token
assert master_api.url
# tests important for CRD - CRU + list
def test_tenants_list(api, custom_tenant):
tenants = api.tenants.list()
assert len(tenants) >= 1
def test_tenant_can_be_created(custom_tenant, tenant_params):
asserts.assert_resource(custom_tenant)
assert custom_tenant.entity["signup"]["account"]["admin_base_url"]
assert custom_tenant.entity["signup"]["access_token"]["value"]
def test_tenant_can_be_read(api, tenant_params, custom_tenant):
read = api.tenants.read(custom_tenant.entity_id)
asserts.assert_resource(read)
asserts.assert_resource_params(read, tenant_params)
# this test does not make sense in 3scale api client too
# def test_tenant_can_be_read_by_name(api, tenant_params, custom_tenant):
# tenant_name = custom_tenant['name']
# read = api.tenants[tenant_name]
# asserts.assert_resource(read)
# asserts.assert_resource_params(read, tenant_params)
def test_tenant_can_be_updated(api, custom_tenant):
des_changed = (custom_tenant["signup"]["account"]["email"] or "") + "_changed"
custom_tenant["signup"]["account"]["email"] = des_changed
custom_tenant.update()
assert custom_tenant["signup"]["account"]["email"] == des_changed
updated = custom_tenant.threescale_client.tenants.read(custom_tenant.entity_id)
assert updated["signup"]["account"]["email"] == des_changed
assert custom_tenant["signup"]["account"]["email"] == des_changed
# 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"