Skip to content

Commit

Permalink
done /adim/api/service/{id}/backend_usages/{id}
Browse files Browse the repository at this point in the history
  • Loading branch information
Gituser010 committed Dec 11, 2024
1 parent c3b1704 commit f0c6046
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,18 @@ def proxy(service, application, api_backend) -> Proxy:


@pytest.fixture(scope='module')
def backend_usage(service, backend, application) -> BackendUsage:
params = {
'service_id': service['id'],
'backend_api_id': backend['id'],
'path': '/get',
}
resource = service.backend_usages.create(params=params)
def backend_usage_update_params(service, backend):
return dict(service_id=service['id'], backend_api_id=backend['id'], path='/put')


@pytest.fixture(scope='module')
def backend_usage_params(service, backend):
return dict(service_id=service['id'], backend_api_id=backend['id'], path='/get')


@pytest.fixture(scope='module')
def backend_usage(service, backend, application, backend_usage_params) -> BackendUsage:
resource = service.backend_usages.create(params=backend_usage_params)
yield resource
cleanup(resource)

Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_integration_account_plans.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from tests.integration import asserts


def test_account_plans_list(api, account_plan):
account_plans = api.account_plans.list()
assert len(account_plans) >= 1
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/test_integration_backend_usages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from tests.integration import asserts
from tests.integration.conftest import backend


def test_backend_usage_can_be_created(backend_usage, backend_usage_params):
asserts.assert_resource(backend_usage)
asserts.assert_resource_params(backend_usage, backend_usage_params)


def test_backend_usages_list(api, backend_usage, backend):
assert len(backend.usages()) >= 1


def test_backend_usage_update(backend_usage, backend, backend_usage_update_params):
updated_backend_usage = backend_usage.update(backend_usage_update_params)
asserts.assert_resource(updated_backend_usage)
asserts.assert_resource_params(updated_backend_usage, backend_usage_update_params)

0 comments on commit f0c6046

Please sign in to comment.