Merge lp:~dobey/pay-service/pychecks into lp:pay-service

Proposed by dobey
Status: Merged
Approved by: Charles Kerr
Approved revision: 121
Merged at revision: 120
Proposed branch: lp:~dobey/pay-service/pychecks
Merge into: lp:pay-service
Prerequisite: lp:~timo-jyrinki/pay-service/stop_depending_on_transitional_packages
Diff against target: 222 lines (+57/-35)
6 files modified
CMakeLists.txt (+12/-0)
debian/control (+2/-0)
pay-ui/backend/tests/mock_click_server.py (+15/-17)
pay-ui/tests/autopilot/pay_ui/tests/__init__.py (+0/-2)
pay-ui/tests/autopilot/pay_ui/tests/mock_server.py (+6/-4)
tests/com_canonical_pay_store.py (+22/-12)
To merge this branch: bzr merge lp:~dobey/pay-service/pychecks
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+295267@code.launchpad.net

Commit message

Add pep8 and pyflakes3 test rules.
Clean up the warnings from pep8 and pyflakes.

To post a comment you must log in.
lp:~dobey/pay-service/pychecks updated
120. By dobey

Fallback for pre-split pyflakes package.

121. By dobey

Fix typo in or dependency.

Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-03-08 23:25:11 +0000
+++ CMakeLists.txt 2016-05-20 14:25:52 +0000
@@ -109,3 +109,15 @@
109 TESTS libpay-iap-tests libpay-package-tests109 TESTS libpay-iap-tests libpay-package-tests
110 FILTER ${filter-list}110 FILTER ${filter-list}
111)111)
112
113
114file(RELATIVE_PATH RELATIVE_SRCDIR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
115##
116## Python static checking
117##
118add_test(NAME pep8
119 COMMAND pep8 ${RELATIVE_SRCDIR}
120)
121add_test(NAME pyflakes
122 COMMAND pyflakes3 ${RELATIVE_SRCDIR}
123)
112124
=== modified file 'debian/control'
--- debian/control 2016-05-20 14:25:52 +0000
+++ debian/control 2016-05-20 14:25:52 +0000
@@ -26,7 +26,9 @@
26 libtrust-store-dev,26 libtrust-store-dev,
27 libubuntu-app-launch2-dev (>= 0.5),27 libubuntu-app-launch2-dev (>= 0.5),
28 libubuntuoneauth-2.0-dev,28 libubuntuoneauth-2.0-dev,
29 pep8,
29 pkg-config,30 pkg-config,
31 pyflakes3 | pyflakes (>= 0.8.1-1),
30 python3-dbusmock,32 python3-dbusmock,
31 qt5-default,33 qt5-default,
32 qtbase5-dev,34 qtbase5-dev,
3335
=== modified file 'pay-ui/backend/tests/mock_click_server.py'
--- pay-ui/backend/tests/mock_click_server.py 2016-03-08 21:28:56 +0000
+++ pay-ui/backend/tests/mock_click_server.py 2016-05-20 14:25:52 +0000
@@ -19,19 +19,17 @@
19 "description": "PayPal",19 "description": "PayPal",
20 "id": "paypal",20 "id": "paypal",
21 "preferred": False,21 "preferred": False,
22 "choices": [22 "choices": [{
23 {23 "currencies": [
24 "currencies": [24 "USD",
25 "USD",25 "GBP",
26 "GBP",26 "EUR"
27 "EUR"27 ],
28 ],28 "id": 532,
29 "id": 532,29 "requires_interaction": False,
30 "requires_interaction": False,30 "preferred": False,
31 "preferred": False,31 "description": "PayPal Preapproved (exp. 2014-04-12)"
32 "description": "PayPal Preapproved Payment (exp. 2014-04-12)"32 }]
33 }
34 ]
35 },33 },
36 {34 {
37 "description": "Credit or Debit Card",35 "description": "Credit or Debit Card",
@@ -45,7 +43,7 @@
45 "id": 1767,43 "id": 1767,
46 "requires_interaction": False,44 "requires_interaction": False,
47 "preferred": False,45 "preferred": False,
48 "description": "**** **** **** 1111 (Visa, exp. 02/2015)"46 "description": "**** **** **** 1111 (X, exp. 02/2015)"
49 },47 },
50 {48 {
51 "currencies": [49 "currencies": [
@@ -54,7 +52,7 @@
54 "id": 1726,52 "id": 1726,
55 "requires_interaction": False,53 "requires_interaction": False,
56 "preferred": True,54 "preferred": True,
57 "description": "**** **** **** 1111 (Visa, exp. 03/2015)"55 "description": "**** **** **** 1111 (X, exp. 03/2015)"
58 }56 }
59 ]57 ]
60 }58 }
@@ -120,8 +118,8 @@
120118
121 def do_POST(self):119 def do_POST(self):
122 """Respond to a POST request."""120 """Respond to a POST request."""
123 #content = self.rfile.read(int(self.headers.get('content-length')))121 # content = self.rfile.read(int(self.headers.get('content-length')))
124 #structure = json.loads(content.decode('utf-8'))122 # structure = json.loads(content.decode('utf-8'))
125 self.do_GET()123 self.do_GET()
126124
127 def do_GET(self):125 def do_GET(self):
128126
=== modified file 'pay-ui/tests/autopilot/pay_ui/tests/__init__.py'
--- pay-ui/tests/autopilot/pay_ui/tests/__init__.py 2016-03-10 21:12:52 +0000
+++ pay-ui/tests/autopilot/pay_ui/tests/__init__.py 2016-05-20 14:25:52 +0000
@@ -15,10 +15,8 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import fixtures17import fixtures
18import json
19import os18import os
20import shutil19import shutil
21import subprocess
22import tempfile20import tempfile
23import ubuntuuitoolkit as uitk21import ubuntuuitoolkit as uitk
2422
2523
=== modified file 'pay-ui/tests/autopilot/pay_ui/tests/mock_server.py'
--- pay-ui/tests/autopilot/pay_ui/tests/mock_server.py 2016-03-08 21:28:56 +0000
+++ pay-ui/tests/autopilot/pay_ui/tests/mock_server.py 2016-05-20 14:25:52 +0000
@@ -22,7 +22,8 @@
2222
23html_success = """23html_success = """
24<html>24<html>
25 <body bgcolor="green" onClick="window.location.assign('/paymentmethods/completeadd')">25 <body bgcolor="green"
26 onClick="window.location.assign('/paymentmethods/completeadd')">
26 <h1>Placeholder for web interaction</h1>27 <h1>Placeholder for web interaction</h1>
27 <p>Click anywhere to proceed</p>28 <p>Click anywhere to proceed</p>
28 </body>29 </body>
@@ -31,7 +32,8 @@
3132
32html_cancel = """33html_cancel = """
33<html>34<html>
34 <body bgcolor="red" onClick="window.location.assign('/api/2.0/click/cancelled')">35 <body bgcolor="red"
36 onClick="window.location.assign('/api/2.0/click/cancelled')">
35 <h1>Placeholder for web interaction</h1>37 <h1>Placeholder for web interaction</h1>
36 <p>Click anywhere to cancel</p>38 <p>Click anywhere to cancel</p>
37 </body>39 </body>
@@ -233,8 +235,8 @@
233235
234 def do_POST(self):236 def do_POST(self):
235 """Respond to a POST request."""237 """Respond to a POST request."""
236 #content = self.rfile.read(int(self.headers.get('content-length')))238 # content = self.rfile.read(int(self.headers.get('content-length')))
237 #structure = json.loads(content.decode('utf-8'))239 # structure = json.loads(content.decode('utf-8'))
238 if self.path.find("purchases/") != -1:240 if self.path.find("purchases/") != -1:
239 self.response_buy_item()241 self.response_buy_item()
240242
241243
=== modified file 'tests/com_canonical_pay_store.py'
--- tests/com_canonical_pay_store.py 2016-01-13 16:41:33 +0000
+++ tests/com_canonical_pay_store.py 2016-05-20 14:25:52 +0000
@@ -48,6 +48,7 @@
48 encoded.append('_{:02x}'.format(ord(ch)))48 encoded.append('_{:02x}'.format(ord(ch)))
49 return ''.join(encoded)49 return ''.join(encoded)
5050
51
51def build_store_path(package_name):52def build_store_path(package_name):
52 return STORE_PATH_PREFIX + '/' + encode_path_element(package_name)53 return STORE_PATH_PREFIX + '/' + encode_path_element(package_name)
5354
@@ -99,7 +100,7 @@
99100
100 item = Item(sku)101 item = Item(sku)
101 store.items[sku] = item102 store.items[sku] = item
102 store.set_item (store, sku, properties)103 store.set_item(store, sku, properties)
103104
104105
105def store_set_item(store, sku, properties):106def store_set_item(store, sku, properties):
@@ -158,7 +159,8 @@
158 elif sku != 'cancel':159 elif sku != 'cancel':
159 item = store.items[sku]160 item = store.items[sku]
160 item.set_property('state', 'approved')161 item.set_property('state', 'approved')
161 item.set_property('purchase_id', dbus.UInt64(store.next_purchase_id))162 item.set_property('purchase_id',
163 dbus.UInt64(store.next_purchase_id))
162 item.set_property('completed_timestamp', dbus.UInt64(time.time()))164 item.set_property('completed_timestamp', dbus.UInt64(time.time()))
163 store.next_purchase_id += 1165 store.next_purchase_id += 1
164 return store_get_item(store, sku)166 return store_get_item(store, sku)
@@ -177,7 +179,8 @@
177 try:179 try:
178 item = store.items[sku]180 item = store.items[sku]
179 if (item.bus_properties['state'] == 'purchased' and181 if (item.bus_properties['state'] == 'purchased' and
180 item.bus_properties['refundable_until'] > dbus.UInt64(time.time())):182 (item.bus_properties['refundable_until'] >
183 dbus.UInt64(time.time()))):
181 del store.items[sku]184 del store.items[sku]
182 return dbus.Dictionary({185 return dbus.Dictionary({
183 'state': 'available',186 'state': 'available',
@@ -232,17 +235,24 @@
232 store.refund_item = store_refund_item235 store.refund_item = store_refund_item
233 store.acknowledge_item = store_acknowledge_item236 store.acknowledge_item = store_acknowledge_item
234 store.AddMethods(STORE_IFACE, [237 store.AddMethods(STORE_IFACE, [
235 ('AddItem', 'a{sv}', '', 'self.add_item(self, args[0])'),238 ('AddItem', 'a{sv}', '',
236 ('SetItem', 'sa{sv}', '', 'self.set_item(self, args[0], args[1])'),239 'self.add_item(self, args[0])'),
237 ('GetItem', 's', 'a{sv}', 'ret = self.get_item(self, args[0])'),240 ('SetItem', 'sa{sv}', '',
238 ('GetPurchasedItems', '', 'aa{sv}', 'ret = self.get_purchased_items(self)'),241 'self.set_item(self, args[0], args[1])'),
239 ('PurchaseItem', 's', 'a{sv}', 'ret = self.purchase_item(self, args[0])'),242 ('GetItem', 's', 'a{sv}',
240 ('RefundItem', 's', 'a{sv}', 'ret = self.refund_item(self, args[0])'),243 'ret = self.get_item(self, args[0])'),
241 ('AcknowledgeItem', 's', 'a{sv}', 'ret = self.acknowledge_item(self, args[0])'),244 ('GetPurchasedItems', '', 'aa{sv}',
242 ])245 'ret = self.get_purchased_items(self)'),
246 ('PurchaseItem', 's', 'a{sv}',
247 'ret = self.purchase_item(self, args[0])'),
248 ('RefundItem', 's', 'a{sv}',
249 'ret = self.refund_item(self, args[0])'),
250 ('AcknowledgeItem', 's', 'a{sv}',
251 'ret = self.acknowledge_item(self, args[0])'),
252 ])
243253
244 for item in items:254 for item in items:
245 store.add_item(store, item);255 store.add_item(store, item)
246256
247257
248def main_get_stores(mock):258def main_get_stores(mock):

Subscribers

People subscribed via source and target branches

to all changes: