Permalink
Browse files

Change confirm_resource to POST to /api/v1/confirm

  • Loading branch information...
1 parent 72792d8 commit 06630752e03a513022fe510d10f25b64a4481380 @alexjg alexjg committed Apr 27, 2012
Showing with 3 additions and 20 deletions.
  1. +1 −7 gocardless/client.py
  2. +2 −13 test/test_client.py
View
8 gocardless/client.py
@@ -256,13 +256,7 @@ def confirm_resource(self, params):
"resource_id":params["resource_id"],
"resource_type":params["resource_type"]
}
- parse_rs = urlparse.urlparse(params["resource_uri"])
- path = parse_rs.path.replace("/api/v1", "")
- if parse_rs.query != '':
- dest = "{0}?{1}".format(path, parse_rs.query)
- else:
- dest = path
- self.api_post(dest, to_post, auth=(self._app_id, self._app_secret))
+ self.api_post("/confirm", to_post, auth=(self._app_id, self._app_secret))
def new_merchant_url(self, redirect_uri, state=None):
"""Get a URL for managing a new merchant
View
15 test/test_client.py
@@ -160,21 +160,10 @@ def test_resource_posts(self):
expected_auth = (mock_account_details["app_id"],
mock_account_details["app_secret"])
self.client.confirm_resource(self.params)
- mock_post.assert_called_with(self.resource_path,
+ expected_path = "/confirm"
+ mock_post.assert_called_with(expected_path,
expected_data, auth=expected_auth)
- def test_resource_post_with_query(self):
- query = '?key2=value2&key1=value1'
- self.params["resource_uri"] += query
- self.params["signature"] = utils.generate_signature(self.params,
- mock_account_details["app_secret"])
- with patch.object(self.client, 'api_post') as mock_post:
- self.client.confirm_resource(self.params)
- expected_path = self.resource_path + query
- mock_post.assert_called_with(expected_path,
- mock._ANY(), auth=mock._ANY())
-
-
class UrlBuilderTestCase(unittest.TestCase):
def setUp(self):

0 comments on commit 0663075

Please sign in to comment.