Skip to content

Commit caacdac

Browse files
committed
Update tests for Service Subscriptions, approve and change plan.
1 parent d22f056 commit caacdac

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

tests/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def account_user(account,account_user_params) -> AccountUser:
152152
@pytest.fixture(scope='module')
153153
def service_plan_params() -> dict:
154154
suffix = get_suffix()
155-
return {"name":f'test-{suffix}'}
155+
return {"name":f'test-{suffix}', "approval_required":'True'}
156156

157157
@pytest.fixture(scope='module')
158158
def service_plan(service, service_plan_params) -> ServicePlan:

tests/integration/test_integration_service_subscriptions.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ def test_read_service_subscription(account, service_subscription, service_subscr
1414
asserts.assert_resource(resource)
1515
asserts.assert_resource_params(service_subscription,service_subscription_params)
1616

17-
def test_change_plan_service_subscription(account, account_plan, service_plan, service_subscription):
17+
def test_change_plan_service_subscription(account, account_plan, service_plan,
18+
service_subscription):
1819
asserts.assert_resource(account)
1920
asserts.assert_resource(account_plan)
21+
asserts.assert_resource(service_plan)
2022
account.service_subscriptions.change_plan(service_subscription.entity_id,
2123
service_plan.entity_id)
2224

23-
# TODO: https://issues.redhat.com/browse/THREESCALE-11693
24-
def test_approve_service_subscription(account, service_subscription,service_subscription_params):
25+
def test_approve_service_subscription(account, service_subscription, service_plan):
2526
asserts.assert_resource(service_subscription)
26-
service_subscription['state'] = 'pending'
27+
asserts.assert_resource(account)
28+
asserts.assert_resource(service_plan)
2729
resource = account.service_subscriptions.approve(service_subscription.entity_id)
2830
asserts.assert_resource(resource)
29-
asserts.assert_resource_params(service_subscription, service_subscription_params)

threescale_api/resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def url(self) -> str:
288288
def approve(self, entity_id: int, **kwargs):
289289
url = self.url + f"/{entity_id}/approve"
290290
response = self.rest.put(url=url, **kwargs)
291-
instance = utils.extract_response(response=response)
291+
instance = self._create_instance(response=response)
292292
return instance
293293

294294
def change_plan(self, entity_id: int, plan_id: int, **kwargs):

0 commit comments

Comments
 (0)