Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for 2.14 changes + bugs in tests #142

Merged
merged 1 commit into from
Jan 16, 2024
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
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
Loading