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
1=== modified file 'setup.py'
2--- setup.py 2013-03-20 12:22:07 +0000
3+++ setup.py 2013-03-25 21:49:20 +0000
4@@ -27,6 +27,10 @@
5 package_dir={'': 'src'},
6 install_requires=[
7 'piston-mini-client',
8+ 'python-dateutil',
9+ ],
10+ tests_require=[
11+ 'mock',
12 ],
13 test_suite='payclient.tests',
14 )
15
16=== modified file 'src/payclient/client.py'
17--- src/payclient/client.py 2013-03-20 12:22:07 +0000
18+++ src/payclient/client.py 2013-03-25 21:49:20 +0000
19@@ -39,8 +39,10 @@
20 'card_ccv',
21 'card_expiration_month',
22 'card_expiration_year',
23+ 'make_unattended_default',
24 'billing_address',
25 )
26+ make_unattended_default = False
27
28
29 class PaymentRequest(PistonSerializable):
30
31=== modified file 'src/payclient/tests/test_client.py'
32--- src/payclient/tests/test_client.py 2013-03-20 12:22:07 +0000
33+++ src/payclient/tests/test_client.py 2013-03-25 21:49:20 +0000
34@@ -46,9 +46,14 @@
35 'card_ccv',
36 'card_expiration_month',
37 'card_expiration_year',
38+ 'make_unattended_default',
39 'billing_address',
40 ))
41
42+ def test_default_attributes(self):
43+ request = CreditCardRequest()
44+ self.assertEqual(request.make_unattended_default, False)
45+
46
47 class PaymentRequestTestCase(TestCase):
48 def test_request_attributes(self):
49@@ -409,14 +414,15 @@
50 'new_credit_card', data=request, api_method='_post')
51
52 def test_new_card_validate(self):
53- try:
54+ with self.assertRaises(ValidationException) as exc:
55 self.auth_api.new_credit_card(data='foo')
56- except ValidationException, e:
57- self.assertEqual(
58- str(e), "Argument 'data' must be a <class "
59- "'payclient.client.CreditCardRequest'>")
60- else:
61- self.fail('ValidationException not raised')
62+
63+ # check for startswith to be compatible with
64+ # different piston_mini_client versions
65+ self.assertTrue(
66+ exc.exception.message.startswith(
67+ "Argument 'data' must be a <class "
68+ "'payclient.client.CreditCardRequest'>"))
69
70 def test_new_card_return_value(self):
71 self.auth_api._post.return_value = self.mock_card_response_body
72@@ -451,14 +457,15 @@
73 self.assert_protected('new_payment', data=request, api_method='_post')
74
75 def test_new_payment_validate(self):
76- try:
77+ with self.assertRaises(ValidationException) as exc:
78 self.auth_api.new_payment(data='foo')
79- except ValidationException, e:
80- self.assertEqual(
81- str(e), "Argument 'data' must be a <class "
82- "'payclient.client.PaymentRequest'>")
83- else:
84- self.fail('ValidationException not raised')
85+
86+ # check for startswith to be compatible with
87+ # different piston_mini_client versions
88+ self.assertTrue(
89+ exc.exception.message.startswith(
90+ "Argument 'data' must be a <class "
91+ "'payclient.client.PaymentRequest'>"))
92
93 def test_new_payment_return_value(self):
94 self.auth_api._post.return_value = self.mock_payment_response_body
95
96=== added file 'tarmac_tests.sh'
97--- tarmac_tests.sh 1970-01-01 00:00:00 +0000
98+++ tarmac_tests.sh 2013-03-25 21:49:20 +0000
99@@ -0,0 +1,5 @@
100+#! /bin/bash
101+
102+set -e
103+
104+python -m unittest discover src

Subscribers

People subscribed via source and target branches