Merge lp:~matiasb/payclient/make-unattended-card-update into lp:payclient

Proposed by Matias Bordese
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 5
Merged at revision: 2
Proposed branch: lp:~matiasb/payclient/make-unattended-card-update
Merge into: lp:payclient
Diff against target: 104 lines (+32/-14)
4 files modified
setup.py (+4/-0)
src/payclient/client.py (+2/-0)
src/payclient/tests/test_client.py (+21/-14)
tarmac_tests.sh (+5/-0)
To merge this branch: bzr merge lp:~matiasb/payclient/make-unattended-card-update
Reviewer Review Type Date Requested Status
Ricardo Kirkner (community) Approve
Review via email: mp+155339@code.launchpad.net

Commit message

Added new credit card optional make_unattended_default parameter.

Description of the change

Added new credit card optional make_unattended_default parameter.

To post a comment you must log in.
Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

LGTM

review: Approve
Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

Need to include necessary dependencies to get tests running, but other than that looks good

=== modified file 'setup.py'
--- setup.py 2013-03-20 12:22:07 +0000
+++ setup.py 2013-03-25 21:42:04 +0000
@@ -27,6 +27,10 @@
     package_dir={'': 'src'},
     install_requires=[
         'piston-mini-client',
+ 'python-dateutil',
+ ],
+ tests_require=[
+ 'mock',
     ],
     test_suite='payclient.tests',
 )

review: Needs Fixing
5. By Matias Bordese

Updated deps in setup.py

Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2013-03-20 12:22:07 +0000
+++ setup.py 2013-03-25 21:49:20 +0000
@@ -27,6 +27,10 @@
27 package_dir={'': 'src'},27 package_dir={'': 'src'},
28 install_requires=[28 install_requires=[
29 'piston-mini-client',29 'piston-mini-client',
30 'python-dateutil',
31 ],
32 tests_require=[
33 'mock',
30 ],34 ],
31 test_suite='payclient.tests',35 test_suite='payclient.tests',
32)36)
3337
=== modified file 'src/payclient/client.py'
--- src/payclient/client.py 2013-03-20 12:22:07 +0000
+++ src/payclient/client.py 2013-03-25 21:49:20 +0000
@@ -39,8 +39,10 @@
39 'card_ccv',39 'card_ccv',
40 'card_expiration_month',40 'card_expiration_month',
41 'card_expiration_year',41 'card_expiration_year',
42 'make_unattended_default',
42 'billing_address',43 'billing_address',
43 )44 )
45 make_unattended_default = False
4446
4547
46class PaymentRequest(PistonSerializable):48class PaymentRequest(PistonSerializable):
4749
=== modified file 'src/payclient/tests/test_client.py'
--- src/payclient/tests/test_client.py 2013-03-20 12:22:07 +0000
+++ src/payclient/tests/test_client.py 2013-03-25 21:49:20 +0000
@@ -46,9 +46,14 @@
46 'card_ccv',46 'card_ccv',
47 'card_expiration_month',47 'card_expiration_month',
48 'card_expiration_year',48 'card_expiration_year',
49 'make_unattended_default',
49 'billing_address',50 'billing_address',
50 ))51 ))
5152
53 def test_default_attributes(self):
54 request = CreditCardRequest()
55 self.assertEqual(request.make_unattended_default, False)
56
5257
53class PaymentRequestTestCase(TestCase):58class PaymentRequestTestCase(TestCase):
54 def test_request_attributes(self):59 def test_request_attributes(self):
@@ -409,14 +414,15 @@
409 'new_credit_card', data=request, api_method='_post')414 'new_credit_card', data=request, api_method='_post')
410415
411 def test_new_card_validate(self):416 def test_new_card_validate(self):
412 try:417 with self.assertRaises(ValidationException) as exc:
413 self.auth_api.new_credit_card(data='foo')418 self.auth_api.new_credit_card(data='foo')
414 except ValidationException, e:419
415 self.assertEqual(420 # check for startswith to be compatible with
416 str(e), "Argument 'data' must be a <class "421 # different piston_mini_client versions
417 "'payclient.client.CreditCardRequest'>")422 self.assertTrue(
418 else:423 exc.exception.message.startswith(
419 self.fail('ValidationException not raised')424 "Argument 'data' must be a <class "
425 "'payclient.client.CreditCardRequest'>"))
420426
421 def test_new_card_return_value(self):427 def test_new_card_return_value(self):
422 self.auth_api._post.return_value = self.mock_card_response_body428 self.auth_api._post.return_value = self.mock_card_response_body
@@ -451,14 +457,15 @@
451 self.assert_protected('new_payment', data=request, api_method='_post')457 self.assert_protected('new_payment', data=request, api_method='_post')
452458
453 def test_new_payment_validate(self):459 def test_new_payment_validate(self):
454 try:460 with self.assertRaises(ValidationException) as exc:
455 self.auth_api.new_payment(data='foo')461 self.auth_api.new_payment(data='foo')
456 except ValidationException, e:462
457 self.assertEqual(463 # check for startswith to be compatible with
458 str(e), "Argument 'data' must be a <class "464 # different piston_mini_client versions
459 "'payclient.client.PaymentRequest'>")465 self.assertTrue(
460 else:466 exc.exception.message.startswith(
461 self.fail('ValidationException not raised')467 "Argument 'data' must be a <class "
468 "'payclient.client.PaymentRequest'>"))
462469
463 def test_new_payment_return_value(self):470 def test_new_payment_return_value(self):
464 self.auth_api._post.return_value = self.mock_payment_response_body471 self.auth_api._post.return_value = self.mock_payment_response_body
465472
=== added file 'tarmac_tests.sh'
--- tarmac_tests.sh 1970-01-01 00:00:00 +0000
+++ tarmac_tests.sh 2013-03-25 21:49:20 +0000
@@ -0,0 +1,5 @@
1#! /bin/bash
2
3set -e
4
5python -m unittest discover src

Subscribers

People subscribed via source and target branches