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 Oct 22, 2024
1 parent 67c2ceb commit 218bf6b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
25 changes: 18 additions & 7 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,24 @@ 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):
service_id = service['id']
backend_api_id = backend['id']
path = '/put'
return dict(service_id=service_id, backend_api_id=backend_api_id, path=path)


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


@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
20 changes: 20 additions & 0 deletions tests/integration/test_integration_backend_usages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from tests.integration import asserts
from tests.integration.conftest import backend
from threescale_api.resources 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):
backend : Backend = api.backends.get(backend['id'])
backend_usages = backend.usages()
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 218bf6b

Please sign in to comment.