Merge lp:~matiasb/click-toolbelt/display-upload-sequence into lp:click-toolbelt

Proposed by Matias Bordese
Status: Merged
Approved by: Matias Bordese
Approved revision: 35
Merged at revision: 36
Proposed branch: lp:~matiasb/click-toolbelt/display-upload-sequence
Merge into: lp:click-toolbelt
Diff against target: 140 lines (+20/-5)
2 files modified
click_toolbelt/tests/test_upload.py (+14/-4)
click_toolbelt/upload.py (+6/-1)
To merge this branch: bzr merge lp:~matiasb/click-toolbelt/display-upload-sequence
Reviewer Review Type Date Requested Status
Ricardo Kirkner (community) Approve
Review via email: mp+275214@code.launchpad.net

Commit message

Updated upload to display sequence on success.

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
Ubuntu One Auto Pilot (otto-pilot) wrote :

The attempt to merge lp:~matiasb/click-toolbelt/display-upload-sequence into lp:click-toolbelt failed. Below is the output from the failed tests.

New python executable in .env/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
Downloading/unpacking cliff (from -r requirements.txt (line 1))
  Running setup.py egg_info for package cliff

    Installed /mnt/tarmac/cache/click-toolbelt/trunk/.env/build/cliff/pbr-1.8.1-py2.7.egg
    [pbr] Processing SOURCES.txt
    warning: LocalManifestMaker: standard file '-c' not found

    warning: no previously-included files found matching '.gitignore'
    warning: no previously-included files found matching '.gitreview'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no files found matching '*.rst' under directory 'docs'
    warning: no files found matching '*.py' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.txt' under directory 'docs'
    warning: no files found matching '*.py' under directory 'tests'
Downloading/unpacking pyxdg (from -r requirements.txt (line 2))
  Running setup.py egg_info for package pyxdg

Downloading/unpacking requests (from -r requirements.txt (line 3))
  Running setup.py egg_info for package requests

Downloading/unpacking requests-oauthlib (from -r requirements.txt (line 4))
  Running setup.py egg_info for package requests-oauthlib

Downloading/unpacking ssoclient (from -r requirements.txt (line 5))
  Downloading ssoclient-2.1.tar.gz
  Running setup.py egg_info for package ssoclient

Downloading/unpacking mock (from -r requirements.txt (line 6))
  Running setup.py egg_info for package mock
    mock requires setuptools>=17.1. Aborting installation
    Complete output from command python setup.py egg_info:
    mock requires setuptools>=17.1. Aborting installation

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /mnt/tarmac/cache/click-toolbelt/trunk/.env/build/mock
Storing complete log in /mnt/tarmac/.pip/pip.log

make: *** [env] Error 1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click_toolbelt/tests/test_upload.py'
2--- click_toolbelt/tests/test_upload.py 2015-04-15 13:51:59 +0000
3+++ click_toolbelt/tests/test_upload.py 2015-10-21 17:18:54 +0000
4@@ -150,6 +150,7 @@
5 'success': False,
6 'errors': ['No valid credentials found.'],
7 'application_url': '',
8+ 'sequence': None,
9 })
10
11 def test_upload_app_uses_environment_variables(self):
12@@ -177,7 +178,8 @@
13 mock_status_response = self.mock_get.return_value
14 mock_status_response.ok = True
15 mock_status_response.json.return_value = {
16- 'completed': True
17+ 'completed': True,
18+ 'sequence': 15,
19 }
20
21 response = self.command.upload_app(self.package_name, self.data)
22@@ -185,6 +187,7 @@
23 'success': True,
24 'errors': [],
25 'application_url': '',
26+ 'sequence': 15,
27 })
28
29 def test_upload_app_error_response(self):
30@@ -198,6 +201,7 @@
31 'success': False,
32 'errors': ['server failure'],
33 'application_url': '',
34+ 'sequence': None,
35 })
36
37 def test_upload_app_handle_malformed_response(self):
38@@ -211,6 +215,7 @@
39 'success': False,
40 'errors': [str(err)],
41 'application_url': '',
42+ 'sequence': None,
43 })
44
45 def test_upload_app_with_errors_during_scan(self):
46@@ -233,7 +238,8 @@
47 self.assertEqual(response, {
48 'success': False,
49 'errors': ['some error'],
50- 'application_url': 'http://example.com/myapp'
51+ 'application_url': 'http://example.com/myapp',
52+ 'sequence': None,
53 })
54
55 def test_upload_app_poll_status(self):
56@@ -253,7 +259,7 @@
57 response_completed.status_code = 200
58 response_completed.encoding = 'utf-8'
59 response_completed._content = json.dumps(
60- {'completed': True,
61+ {'completed': True, 'sequence': 14,
62 'application_url': 'http://example.org'}).encode('utf-8')
63 self.mock_get.side_effect = [
64 response_not_completed,
65@@ -265,6 +271,7 @@
66 'success': True,
67 'errors': [],
68 'application_url': 'http://example.org',
69+ 'sequence': 14,
70 })
71 self.assertEqual(self.mock_get.call_count, 3)
72
73@@ -280,7 +287,7 @@
74 ok_response.status_code = 200
75 ok_response.encoding = 'utf-8'
76 ok_response._content = json.dumps(
77- {'completed': True}).encode('utf-8')
78+ {'completed': True, 'sequence': 14}).encode('utf-8')
79 nok_response = Response()
80 nok_response.status_code = 503
81
82@@ -290,6 +297,7 @@
83 'success': True,
84 'errors': [],
85 'application_url': '',
86+ 'sequence': 14,
87 })
88 self.assertEqual(self.mock_get.call_count, 3)
89
90@@ -316,6 +324,7 @@
91 'http://example.com/status-web/.',
92 ],
93 'application_url': '',
94+ 'sequence': None,
95 })
96
97 def test_upload_app_abort_polling_without_web_status_url(self):
98@@ -338,6 +347,7 @@
99 'Package scan took too long.',
100 ],
101 'application_url': '',
102+ 'sequence': None,
103 })
104
105 def test_upload_app_with_metadata(self):
106
107=== modified file 'click_toolbelt/upload.py'
108--- click_toolbelt/upload.py 2015-04-15 13:51:59 +0000
109+++ click_toolbelt/upload.py 2015-10-21 17:18:54 +0000
110@@ -71,9 +71,12 @@
111 success = result.get('success', False)
112 errors = result.get('errors', [])
113 app_url = result.get('application_url', '')
114+ sequence = result.get('sequence')
115
116 if success:
117 self.log.info('Application uploaded successfully.')
118+ if sequence:
119+ self.log.info('Uploaded as sequence %s.', sequence)
120 else:
121 self.log.info('Upload did not complete.')
122
123@@ -143,7 +146,8 @@
124 def upload_app(self, name, upload_data, metadata=None):
125 upload_url = self.get_upload_url(name)
126
127- result = {'success': False, 'errors': [], 'application_url': ''}
128+ result = {'success': False, 'errors': [],
129+ 'application_url': '', 'sequence': None}
130
131 session = self.get_oauth_session()
132 if session is None:
133@@ -169,6 +173,7 @@
134 message = data.get('message', '')
135 if not message:
136 result['success'] = True
137+ result['sequence'] = data.get('sequence')
138 else:
139 result['errors'] = [message]
140 else:

Subscribers

People subscribed via source and target branches