-
Notifications
You must be signed in to change notification settings - Fork 437
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 #456 from stripe/remi-add-scheduled-query-run
Add support for ScheduledQueryRun
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
# flake8: noqa | ||
|
||
from stripe.api_resources.sigma.scheduled_query_run import ScheduledQueryRun |
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,11 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe.api_resources.abstract import ListableAPIResource | ||
|
||
|
||
class ScheduledQueryRun(ListableAPIResource): | ||
OBJECT_NAME = 'scheduled_query_run' | ||
|
||
@classmethod | ||
def class_url(cls): | ||
return '/v1/sigma/scheduled_query_runs' |
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,46 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
TEST_RESOURCE_ID = 'sqr_123' | ||
|
||
|
||
class TestTransaction(object): | ||
FIXTURE = { | ||
'id': TEST_RESOURCE_ID, | ||
'object': 'scheduled_query_run' | ||
} | ||
|
||
def test_is_listable(self, request_mock): | ||
request_mock.stub_request( | ||
'get', | ||
'/v1/sigma/scheduled_query_runs', | ||
{ | ||
'object': 'list', | ||
'data': [self.FIXTURE], | ||
} | ||
) | ||
resources = stripe.sigma.ScheduledQueryRun.list() | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/sigma/scheduled_query_runs' | ||
) | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], stripe.sigma.ScheduledQueryRun) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
request_mock.stub_request( | ||
'get', | ||
'/v1/sigma/scheduled_query_runs/%s' % TEST_RESOURCE_ID, | ||
{ | ||
'id': '%s' % TEST_RESOURCE_ID, | ||
'object': 'scheduled_query_run' | ||
} | ||
) | ||
resource = stripe.sigma.ScheduledQueryRun.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/sigma/scheduled_query_runs/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.sigma.ScheduledQueryRun) |