Skip to content

Commit c6f5dcb

Browse files
authored
Merge pull request 3scale-qe#142 from mkudlej/fix_test_issues_for_214
fixes for 2.14 changes + bugs in tests
2 parents 012dab2 + 3e9d6ca commit c6f5dcb

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

tests/integration/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,15 @@ def backend(backend_params, api) -> Backend:
360360
cleanup(backend)
361361

362362
@pytest.fixture(scope='module')
363-
def backend_metric(backend, metric_params) -> Metric:
363+
def backend_metric(backend, metric_params, proxy) -> Metric:
364364
"""
365365
Fixture for getting backend metric.
366366
"""
367367
resource = backend.metrics.create(params=metric_params)
368368
yield resource
369+
for map_rule in backend.mapping_rules.select_by(metric_id=resource['id']):
370+
map_rule.delete()
371+
proxy.deploy()
369372
cleanup(resource)
370373

371374
@pytest.fixture(scope="module")

tests/integration/test_integration_methods.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
from tests.integration import asserts
66

7-
def test_list_methods(metric, method):
8-
assert len(metric.methods.list()) >= 1
7+
def test_list_methods(hits_metric, method):
8+
assert len(hits_metric.methods.list()) >= 1
99

1010
def test_should_create_method(method, method_params):
1111
asserts.assert_resource(method)
1212
asserts.assert_resource_params(method, method_params)
1313

1414

15-
def test_should_not_create_method_for_custom_metric(metric, method_params):
16-
resource = metric.methods.create(params=method_params, throws=False)
17-
asserts.assert_errors_contains(resource, ['parent_id'])
15+
def test_should_not_create_method_for_custom_metric(hits_metric, method_params):
16+
resource = hits_metric.methods.create(params=method_params, throws=False)
17+
asserts.assert_errors_contains(resource, ['system_name'])
1818

1919

2020
def test_should_friendly_name_be_required(hits_metric):

tests/integration/test_integration_tenant.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,29 @@ def count_invoice(api, account):
4040
return len(api.invoices.list_by_account(account))
4141

4242

43-
def test_trigger_billing(master_api, custom_tenant, paid_account, next_day):
44-
api = custom_tenant.admin_api(wait=True)
43+
def test_trigger_billing(master_api, custom_tenant, paid_account, next_day, ssl_verify):
44+
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
4545
account = paid_account(api)
4646
assert master_api.tenants.trigger_billing(custom_tenant, next_day)
4747
assert count_invoice(api, account) == 1
4848

4949

50-
def test_trigger_billing_resource(custom_tenant, paid_account, next_day):
51-
api = custom_tenant.admin_api(wait=True)
50+
def test_trigger_billing_resource(custom_tenant, paid_account, next_day, ssl_verify):
51+
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
5252
account = paid_account(api)
5353
assert custom_tenant.trigger_billing(next_day)
5454
assert count_invoice(api, account) == 1
5555

5656

57-
def test_trigger_billing_account(master_api, custom_tenant, paid_account, next_day):
58-
api = custom_tenant.admin_api(wait=True)
57+
def test_trigger_billing_account(master_api, custom_tenant, paid_account, next_day, ssl_verify):
58+
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
5959
account = paid_account(api)
6060
assert master_api.tenants.trigger_billing_account(custom_tenant, account, next_day)
6161
assert count_invoice(api, account) == 1
6262

6363

64-
def test_trigger_billing_account_resource(custom_tenant, paid_account, next_day):
65-
api = custom_tenant.admin_api(wait=True)
64+
def test_trigger_billing_account_resource(custom_tenant, paid_account, next_day, ssl_verify):
65+
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
6666
account = paid_account(api)
6767
assert custom_tenant.trigger_billing_account(account, next_day)
6868
assert count_invoice(api, account) == 1

0 commit comments

Comments
 (0)