Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for radar.early_fraud_warning resource #575

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cache:
env:
global:
# If changing this number, please also change it in `tests/conftest.py`.
- STRIPE_MOCK_VERSION=0.56.0
- STRIPE_MOCK_VERSION=0.57.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
Expand Down
1 change: 1 addition & 0 deletions stripe/api_resources/radar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

# flake8: noqa

from stripe.api_resources.radar.early_fraud_warning import EarlyFraudWarning
from stripe.api_resources.radar.value_list import ValueList
from stripe.api_resources.radar.value_list_item import ValueListItem
7 changes: 7 additions & 0 deletions stripe/api_resources/radar/early_fraud_warning.py
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 ListableAPIResource


class EarlyFraudWarning(ListableAPIResource):
OBJECT_NAME = "radar.early_fraud_warning"
1 change: 1 addition & 0 deletions stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def load_object_classes():
api_resources.Person.OBJECT_NAME: api_resources.Person,
api_resources.Plan.OBJECT_NAME: api_resources.Plan,
api_resources.Product.OBJECT_NAME: api_resources.Product,
api_resources.radar.EarlyFraudWarning.OBJECT_NAME: api_resources.radar.EarlyFraudWarning,
api_resources.radar.ValueList.OBJECT_NAME: api_resources.radar.ValueList,
api_resources.radar.ValueListItem.OBJECT_NAME: api_resources.radar.ValueListItem,
api_resources.Recipient.OBJECT_NAME: api_resources.Recipient,
Expand Down
21 changes: 21 additions & 0 deletions tests/api_resources/radar/test_early_fraud_warning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import absolute_import, division, print_function

import stripe


TEST_RESOURCE_ID = "issfr_123"


class TestEarlyFraudWarning(object):
def test_is_listable(self, request_mock):
resources = stripe.radar.EarlyFraudWarning.list()
request_mock.assert_requested("get", "/v1/radar/early_fraud_warnings")
assert isinstance(resources.data, list)
assert isinstance(resources.data[0], stripe.radar.EarlyFraudWarning)

def test_is_retrievable(self, request_mock):
resource = stripe.radar.EarlyFraudWarning.retrieve(TEST_RESOURCE_ID)
request_mock.assert_requested(
"get", "/v1/radar/early_fraud_warnings/%s" % TEST_RESOURCE_ID
)
assert isinstance(resource, stripe.radar.EarlyFraudWarning)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


# When changing this number, don't forget to change it in `.travis.yml` too.
MOCK_MINIMUM_VERSION = "0.56.0"
MOCK_MINIMUM_VERSION = "0.57.0"

# Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and
# otherwise fall back to `STRIPE_MOCK_PORT` or 12111.
Expand Down