Skip to content

Commit 9913377

Browse files
committed
Add tests into ServiceSubscriptions resource
1 parent bf57f21 commit 9913377

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

tests/integration/test_integration_service_subscriptions.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ def test_read_service_subscription(account, service_subscription, service_subscr
1414
resource = account.service_subscriptions.read(service_subscription.entity_id)
1515
asserts.assert_resource(resource)
1616
asserts.assert_resource_params(service_subscription,service_subscription_params)
17+
18+
19+
def test_change_plan_service_subscription(account, account_plan, service_subscription):
20+
asserts.assert_resource(account)
21+
asserts.assert_resource(account_plan)
22+
resource = account.service_subscriptions.change_plan(service_subscription.entity_id,
23+
account_plan.entity_id)
24+
asserts.assert_resource(resource)
25+
26+
27+
# TODO: https://issues.redhat.com/browse/THREESCALE-11693
28+
def test_approve_service_subscription(account, service_subscription,service_subscription_params):
29+
asserts.assert_resource(service_subscription)
30+
service_subscription['state'] = 'pending'
31+
account.service_subscriptions.update(service_subscription.entity_id,
32+
service_subscription_params)
33+
resource = account.service_subscriptions.approve(service_subscription.entity_id)
34+
asserts.assert_resource(resource)
35+
asserts.assert_resource_params(service_subscription, service_subscription_params)

threescale_api/resources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ def url(self) -> str:
286286
return self.parent.url + '/service_subscriptions'
287287

288288
def approve(self, entity_id: int, **kwargs):
289-
url = self.url + f"/{entity_id}/approve.json"
289+
url = self.url + f"/{entity_id}/approve"
290290
response = self.rest.put(url=url, **kwargs)
291291
instance = utils.extract_response(response=response)
292292
return instance
293293

294294
def change_plan(self, entity_id: int, plan_id: int, **kwargs):
295295
params = {"plan_id": plan_id}
296-
url = self.url + f"/{entity_id}/change_plan.json"
297-
response = self.rest.put(url=url, json=params, **kwargs)
296+
url = self.url + f"/{entity_id}/change_plan"
297+
response = self.rest.put(url=url, params=params)
298298
instance = utils.extract_response(response=response)
299299
return instance
300300

0 commit comments

Comments
 (0)