This repository has been archived by the owner on May 12, 2020. It is now read-only.
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 #34 from paypal/rel-0.7.0
Rel 0.7.0
- Loading branch information
Showing
27 changed files
with
962 additions
and
210 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,2 @@ | ||
[run] | ||
source = paypalrestsdk |
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
*.pyc | ||
*.noseids | ||
.coverage | ||
build/ | ||
dist/ | ||
MANIFEST | ||
|
||
.*.sw* |
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
language: python | ||
python: | ||
- "2.6" | ||
- "2.7" | ||
- "3.2" | ||
- "3.3" | ||
- '2.6' | ||
- '2.7' | ||
- '3.2' | ||
- '3.3' | ||
install: | ||
- pip install -r requirements.txt --use-mirrors | ||
- pip install coverage | ||
- pip install coveralls | ||
- pip install -r requirements.txt --use-mirrors | ||
- pip install coverage | ||
- pip install coveralls | ||
script: | ||
- nosetests --with-coverage --cover-package=paypalrestsdk --include=paypalrestsdk/* | ||
- nosetests --with-coverage --cover-package=paypalrestsdk --include=paypalrestsdk/* --exclude=functional* | ||
after_success: | ||
- coveralls | ||
- coveralls | ||
notifications: | ||
webhooks: | ||
urls: | ||
- secure: AQB+jHDVe3JuypMbSFxIObXIlB87ft2zqgVjXctmMu1qfybn9FzL6azrhL+rnVYb9O2paoETKX73jiJTcaN4yu/l92XG3qqinzISu1rhAE0Nx0uBnZD8VAKq7synCRqSuGvhe1PRT7HnqimJU4OjBtkXd20rRkJd0LhNf+PvXAU= | ||
on_success: change | ||
on_failure: always |
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,66 @@ | ||
''' | ||
@patch('test_helper.paypal.Api.post', autospec=True) | ||
@patch('test_helper.paypal.Api.get', autospec=True) | ||
def test_reauthorize(self, mock_get, mock_post): | ||
mock_get.return_value = {'id': 'PAY-888868365Y436124EKLKW6JA', 'update_time': '2014-01-14T17:09:00Z', 'links': [], 'payer' : {}, | ||
'transactions': [{'related_resources': [{'authorization': self.authorization_attributes}], | ||
}]} | ||
response = self.payment.create() | ||
authorization = self.payment.transactions[0].related_resources[0].authorization | ||
|
||
authorization.amount = { | ||
"currency": "USD", | ||
"total": "7.00" } | ||
|
||
mock_post.return_value = { "id": "8AA831015G517922L", "create_time": "2013-06-25T21:39:15Z", | ||
"update_time": "2013-06-25T21:39:17Z", | ||
"state": "authorized", | ||
"amount": { | ||
"total": "7.00", | ||
"currency": "USD" | ||
}, | ||
"parent_payment": "PAY-7LD317540C810384EKHFAGYA", | ||
"valid_until": "2013-07-24T21:39:15Z", | ||
"links": [ | ||
{ | ||
"href": "https://api.sandbox.paypal.com/v1/payments/authorization/8AA831015G517922L", | ||
"rel": "self", | ||
"method": "GET" | ||
}, | ||
{ | ||
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-7LD317540C810384EKHFAGYA", | ||
"rel": "parent_payment", | ||
"method": "GET" | ||
}, | ||
{ | ||
"href": "https://api.sandbox.paypal.com/v1/payments/authorization/8AA831015G517922L/capture", | ||
"rel": "capture", | ||
"method": "POST" | ||
} | ||
] | ||
} | ||
response = authorization.reauthorize() | ||
self.assertEqual(response, True) | ||
mock_post.assert_called_once_with(authorization.api) | ||
|
||
|
||
@patch('test_helper.paypal.Api.get', autospec=True) | ||
def test_capture_find(self, mock): | ||
capture_id = '7S373777UY2709045' | ||
capture = paypal.Capture.find(capture_id) | ||
self.assertEqual(capture.__class__, paypal.Capture) | ||
mock.assert_called_once_with(capture.api, 'v1/payments/capture/' + capture_id) | ||
|
||
with patch.object(paypal.Api, 'post', return_value=None) as mock_post: | ||
mock_post.return_value = { "id": "8AA831015G517922L"} | ||
refund = capture.refund({ "amount": { "currency": "USD", "total": "1.00" } }) | ||
''' | ||
|
||
''' | ||
@patch('test_helper.paypal.Api.get', autospec=True) | ||
def test_refund(self, mock_get): | ||
sale = paypal.Sale.find(self.create_sale().id) | ||
mock_get.assert_called_once_with(sale.api,'v1/payments/sale/5VX40080GX603650') | ||
refund = sale.refund({ "amount": { "total": "0.01", "currency": "USD" } }) | ||
self.assertEqual(refund.success(), True) | ||
''' |
Oops, something went wrong.