Skip to content

Commit

Permalink
add ssl verify value from fixture, change methods to hits as a parent…
Browse files Browse the repository at this point in the history
…, metric cannot be deleted if it is part of deployed proxy
  • Loading branch information
mkudlej committed Nov 28, 2023
1 parent 012dab2 commit 3e9d6ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,15 @@ def backend(backend_params, api) -> Backend:
cleanup(backend)

@pytest.fixture(scope='module')
def backend_metric(backend, metric_params) -> Metric:
def backend_metric(backend, metric_params, proxy) -> Metric:
"""
Fixture for getting backend metric.
"""
resource = backend.metrics.create(params=metric_params)
yield resource
for map_rule in backend.mapping_rules.select_by(metric_id=resource['id']):
map_rule.delete()
proxy.deploy()
cleanup(resource)

@pytest.fixture(scope="module")
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_integration_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

from tests.integration import asserts

def test_list_methods(metric, method):
assert len(metric.methods.list()) >= 1
def test_list_methods(hits_metric, method):
assert len(hits_metric.methods.list()) >= 1

def test_should_create_method(method, method_params):
asserts.assert_resource(method)
asserts.assert_resource_params(method, method_params)


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


def test_should_friendly_name_be_required(hits_metric):
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/test_integration_tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ def count_invoice(api, account):
return len(api.invoices.list_by_account(account))


def test_trigger_billing(master_api, custom_tenant, paid_account, next_day):
api = custom_tenant.admin_api(wait=True)
def test_trigger_billing(master_api, custom_tenant, paid_account, next_day, ssl_verify):
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
account = paid_account(api)
assert master_api.tenants.trigger_billing(custom_tenant, next_day)
assert count_invoice(api, account) == 1


def test_trigger_billing_resource(custom_tenant, paid_account, next_day):
api = custom_tenant.admin_api(wait=True)
def test_trigger_billing_resource(custom_tenant, paid_account, next_day, ssl_verify):
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
account = paid_account(api)
assert custom_tenant.trigger_billing(next_day)
assert count_invoice(api, account) == 1


def test_trigger_billing_account(master_api, custom_tenant, paid_account, next_day):
api = custom_tenant.admin_api(wait=True)
def test_trigger_billing_account(master_api, custom_tenant, paid_account, next_day, ssl_verify):
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
account = paid_account(api)
assert master_api.tenants.trigger_billing_account(custom_tenant, account, next_day)
assert count_invoice(api, account) == 1


def test_trigger_billing_account_resource(custom_tenant, paid_account, next_day):
api = custom_tenant.admin_api(wait=True)
def test_trigger_billing_account_resource(custom_tenant, paid_account, next_day, ssl_verify):
api = custom_tenant.admin_api(ssl_verify=ssl_verify, wait=True)
account = paid_account(api)
assert custom_tenant.trigger_billing_account(account, next_day)
assert count_invoice(api, account) == 1

0 comments on commit 3e9d6ca

Please sign in to comment.