-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #500 from stripe/remi-add-radar-review
Add support for the Review resource
- Loading branch information
Showing
6 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe import util | ||
from stripe.api_resources.abstract import ListableAPIResource | ||
|
||
|
||
class Review(ListableAPIResource): | ||
OBJECT_NAME = 'review' | ||
|
||
def approve(self, idempotency_key=None, **params): | ||
url = self.instance_url() + '/approve' | ||
headers = util.populate_headers(idempotency_key) | ||
self.refresh_from(self.request('post', url, params, headers)) | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
TEST_RESOURCE_ID = 'prv_123' | ||
|
||
|
||
class TestReview(object): | ||
def test_is_listable(self, request_mock): | ||
resources = stripe.Review.list() | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/reviews' | ||
) | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], stripe.Review) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = stripe.Review.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/reviews/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.Review) | ||
|
||
def test_is_approveable(self, request_mock): | ||
resource = stripe.Review.retrieve(TEST_RESOURCE_ID) | ||
resource.approve() | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/reviews/%s/approve' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.Review) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters