-
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.
- Loading branch information
1 parent
0e24cf9
commit fbbfa99
Showing
7 changed files
with
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
# flake8: noqa | ||
|
||
from stripe.api_resources.terminal.connection_token import ConnectionToken | ||
from stripe.api_resources.terminal.locations import Location | ||
from stripe.api_resources.terminal.readers import Reader |
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,7 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe.api_resources.abstract import CreateableAPIResource | ||
|
||
|
||
class ConnectionToken(CreateableAPIResource): | ||
OBJECT_NAME = 'terminal.connection_token' |
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,10 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe.api_resources.abstract import CreateableAPIResource | ||
from stripe.api_resources.abstract import UpdateableAPIResource | ||
from stripe.api_resources.abstract import ListableAPIResource | ||
|
||
|
||
class Location(CreateableAPIResource, ListableAPIResource, | ||
UpdateableAPIResource): | ||
OBJECT_NAME = 'terminal.location' |
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,10 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe.api_resources.abstract import CreateableAPIResource | ||
from stripe.api_resources.abstract import UpdateableAPIResource | ||
from stripe.api_resources.abstract import ListableAPIResource | ||
|
||
|
||
class Reader(CreateableAPIResource, ListableAPIResource, | ||
UpdateableAPIResource): | ||
OBJECT_NAME = 'terminal.reader' |
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,16 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
TEST_RESOURCE_ID = 'rdr_123' | ||
|
||
|
||
class TestConnectionToken(object): | ||
def test_is_creatable(self, request_mock): | ||
resource = stripe.terminal.ConnectionToken.create() | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/connection_token' | ||
) | ||
assert isinstance(resource, stripe.terminal.ConnectionToken) |
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,64 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
TEST_RESOURCE_ID = 'loc_123' | ||
|
||
|
||
class TestLocation(object): | ||
def test_is_creatable(self, request_mock): | ||
resource = stripe.terminal.Location.create( | ||
display_name='name', | ||
address={ | ||
'line1': 'line1', | ||
'country': 'US', | ||
'state': 'CA', | ||
'postal_code': '12345', | ||
'city': 'San Francisco', | ||
} | ||
) | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/locations' | ||
) | ||
assert isinstance(resource, stripe.terminal.Location) | ||
|
||
def test_is_listable(self, request_mock): | ||
resources = stripe.terminal.Location.list() | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/terminal/locations' | ||
) | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], stripe.terminal.Location) | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = stripe.terminal.Location.modify( | ||
TEST_RESOURCE_ID, | ||
display_name='new-name' | ||
) | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/locations/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Location) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = stripe.terminal.Location.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/temrinal/locations/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Location) | ||
|
||
def test_is_saveable(self, request_mock): | ||
resource = stripe.terminal.Location.retrieve(TEST_RESOURCE_ID) | ||
resource.display_name = 'new-name' | ||
location = resource.save() | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/locations/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Location) | ||
assert resource is location |
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,58 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
TEST_RESOURCE_ID = 'rdr_123' | ||
|
||
|
||
class TestReader(object): | ||
def test_is_creatable(self, request_mock): | ||
resource = stripe.terminal.Reader.create( | ||
registration_code='a-b-c', | ||
label='name' | ||
) | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/readers' | ||
) | ||
assert isinstance(resource, stripe.terminal.Reader) | ||
|
||
def test_is_listable(self, request_mock): | ||
resources = stripe.terminal.Reader.list() | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/terminal/readers' | ||
) | ||
assert isinstance(resources.data, list) | ||
assert isinstance(resources.data[0], stripe.terminal.Reader) | ||
|
||
def test_is_modifiable(self, request_mock): | ||
resource = stripe.terminal.Reader.modify( | ||
TEST_RESOURCE_ID, | ||
label='new-name' | ||
) | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/readers/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Reader) | ||
|
||
def test_is_retrievable(self, request_mock): | ||
resource = stripe.terminal.Reader.retrieve(TEST_RESOURCE_ID) | ||
request_mock.assert_requested( | ||
'get', | ||
'/v1/temrinal/readers/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Reader) | ||
|
||
def test_is_saveable(self, request_mock): | ||
resource = stripe.terminal.Reader.retrieve(TEST_RESOURCE_ID) | ||
resource.label = 'new-name' | ||
reader = resource.save() | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/terminal/readers/%s' % TEST_RESOURCE_ID | ||
) | ||
assert isinstance(resource, stripe.terminal.Reader) | ||
assert resource is reader |