Merge lp:~frankban/juju-quickstart/header-fixes into lp:juju-quickstart
- header-fixes
- Merge into trunk
Proposed by
Francesco Banconi
Status: | Merged |
---|---|
Merged at revision: | 8 |
Proposed branch: | lp:~frankban/juju-quickstart/header-fixes |
Merge into: | lp:juju-quickstart |
Diff against target: |
369 lines (+83/-85) 15 files modified
Makefile (+2/-2) juju-quickstart (+2/-2) quickstart/__init__.py (+2/-2) quickstart/app.py (+2/-2) quickstart/juju.py (+5/-7) quickstart/manage.py (+3/-3) quickstart/tests/__init__.py (+2/-2) quickstart/tests/helpers.py (+16/-16) quickstart/tests/test_app.py (+2/-2) quickstart/tests/test_juju.py (+2/-2) quickstart/tests/test_manage.py (+2/-2) quickstart/tests/test_utils.py (+22/-22) quickstart/utils.py (+14/-14) setup.py (+4/-4) test-requirements.pip (+3/-3) |
To merge this branch: | bzr merge lp:~frankban/juju-quickstart/header-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+193220@code.launchpad.net |
Commit message
Description of the change
File header fixes + pep8.
To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote : | # |
Revision history for this message
Francesco Banconi (frankban) wrote : | # |
Self review: trivial.
Revision history for this message
Francesco Banconi (frankban) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile' |
2 | --- Makefile 2013-10-17 16:51:55 +0000 |
3 | +++ Makefile 2013-10-30 11:38:53 +0000 |
4 | @@ -1,5 +1,5 @@ |
5 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
6 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
7 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
8 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
9 | # Copyright (C) 2012-2013 Canonical Ltd. |
10 | # |
11 | # This program is free software: you can redistribute it and/or modify it under |
12 | |
13 | === modified file 'juju-quickstart' |
14 | --- juju-quickstart 2013-10-15 15:31:12 +0000 |
15 | +++ juju-quickstart 2013-10-30 11:38:53 +0000 |
16 | @@ -1,7 +1,7 @@ |
17 | #!/usr/bin/env python |
18 | |
19 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
20 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
21 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
22 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
23 | # Copyright (C) 2013 Canonical Ltd. |
24 | # |
25 | # This program is free software: you can redistribute it and/or modify it under |
26 | |
27 | === modified file 'quickstart/__init__.py' |
28 | --- quickstart/__init__.py 2013-10-22 16:36:51 +0000 |
29 | +++ quickstart/__init__.py 2013-10-30 11:38:53 +0000 |
30 | @@ -1,5 +1,5 @@ |
31 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
32 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
33 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
34 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
35 | # Copyright (C) 2013 Canonical Ltd. |
36 | # |
37 | # This program is free software: you can redistribute it and/or modify it under |
38 | |
39 | === modified file 'quickstart/app.py' |
40 | --- quickstart/app.py 2013-10-18 14:51:29 +0000 |
41 | +++ quickstart/app.py 2013-10-30 11:38:53 +0000 |
42 | @@ -1,5 +1,5 @@ |
43 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
44 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
45 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
46 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
47 | # Copyright (C) 2013 Canonical Ltd. |
48 | # |
49 | # This program is free software: you can redistribute it and/or modify it under |
50 | |
51 | === modified file 'quickstart/juju.py' |
52 | --- quickstart/juju.py 2013-10-18 12:01:12 +0000 |
53 | +++ quickstart/juju.py 2013-10-30 11:38:53 +0000 |
54 | @@ -1,5 +1,5 @@ |
55 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
56 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
57 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
58 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
59 | # Copyright (C) 2013 Canonical Ltd. |
60 | # |
61 | # This program is free software: you can redistribute it and/or modify it under |
62 | @@ -37,7 +37,8 @@ |
63 | """A Juju bootstrapped environment. |
64 | |
65 | Instances of this class can be used to run API operations on a Juju |
66 | - environment. This is a subclass of the jujuclient.Environment object. |
67 | + environment. Specifically this subclass enables bundle support and |
68 | + deployments to specific machines. |
69 | """ |
70 | |
71 | def deploy( |
72 | @@ -97,10 +98,7 @@ |
73 | |
74 | |
75 | class WebSocketConnection(websocket.WebSocket): |
76 | - """A WebSocket client connection. |
77 | - |
78 | - This is a subclass of the websocket.WebSocket object. |
79 | - """ |
80 | + """A WebSocket client connection.""" |
81 | |
82 | def send(self, message): |
83 | """Send the given WebSocket message. |
84 | |
85 | === modified file 'quickstart/manage.py' |
86 | --- quickstart/manage.py 2013-10-22 21:49:26 +0000 |
87 | +++ quickstart/manage.py 2013-10-30 11:38:53 +0000 |
88 | @@ -1,5 +1,5 @@ |
89 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
90 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
91 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
92 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
93 | # Copyright (C) 2013 Canonical Ltd. |
94 | # |
95 | # This program is free software: you can redistribute it and/or modify it under |
96 | @@ -125,7 +125,7 @@ |
97 | def setup(): |
98 | """Set up the application options and logger. |
99 | |
100 | - Return the options as a namespace containing the followin attributes: |
101 | + Return the options as a namespace containing the following attributes: |
102 | - admin_secret: the password to use to access the Juju API; |
103 | - env_file: the absolute path of the Juju environments.yaml file; |
104 | - env_name: the name of the Juju environment to use; |
105 | |
106 | === modified file 'quickstart/tests/__init__.py' |
107 | --- quickstart/tests/__init__.py 2013-10-14 11:27:50 +0000 |
108 | +++ quickstart/tests/__init__.py 2013-10-30 11:38:53 +0000 |
109 | @@ -1,5 +1,5 @@ |
110 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
111 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
112 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
113 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
114 | # Copyright (C) 2013 Canonical Ltd. |
115 | # |
116 | # This program is free software: you can redistribute it and/or modify it under |
117 | |
118 | === modified file 'quickstart/tests/helpers.py' |
119 | --- quickstart/tests/helpers.py 2013-10-22 00:31:37 +0000 |
120 | +++ quickstart/tests/helpers.py 2013-10-30 11:38:53 +0000 |
121 | @@ -1,5 +1,5 @@ |
122 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
123 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
124 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
125 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
126 | # Copyright (C) 2013 Canonical Ltd. |
127 | # |
128 | # This program is free software: you can redistribute it and/or modify it under |
129 | @@ -37,20 +37,6 @@ |
130 | mock_log.assert_has_calls(expected_calls) |
131 | |
132 | |
133 | -class CallTestsMixin(object): |
134 | - """Easily use the quickstart.utils.call function.""" |
135 | - |
136 | - def patch_call(self, retcode, output='', error=''): |
137 | - """Patch the quickstart.utils.call function.""" |
138 | - mock_call = mock.Mock(return_value=(retcode, output, error)) |
139 | - return mock.patch('quickstart.utils.call', mock_call) |
140 | - |
141 | - def patch_multiple_calls(self, side_effect): |
142 | - """Patch multiple subsequent quickstart.utils.call calls.""" |
143 | - mock_call = mock.Mock(side_effect=side_effect) |
144 | - return mock.patch('quickstart.utils.call', mock_call) |
145 | - |
146 | - |
147 | class BundleFileTestsMixin(object): |
148 | """Shared methods for testing Juju bundle files.""" |
149 | |
150 | @@ -77,6 +63,20 @@ |
151 | return bundle_file.name |
152 | |
153 | |
154 | +class CallTestsMixin(object): |
155 | + """Easily use the quickstart.utils.call function.""" |
156 | + |
157 | + def patch_call(self, retcode, output='', error=''): |
158 | + """Patch the quickstart.utils.call function.""" |
159 | + mock_call = mock.Mock(return_value=(retcode, output, error)) |
160 | + return mock.patch('quickstart.utils.call', mock_call) |
161 | + |
162 | + def patch_multiple_calls(self, side_effect): |
163 | + """Patch multiple subsequent quickstart.utils.call calls.""" |
164 | + mock_call = mock.Mock(side_effect=side_effect) |
165 | + return mock.patch('quickstart.utils.call', mock_call) |
166 | + |
167 | + |
168 | class EnvFileTestsMixin(object): |
169 | """Shared methods for testing a Juju environments file.""" |
170 | |
171 | |
172 | === modified file 'quickstart/tests/test_app.py' |
173 | --- quickstart/tests/test_app.py 2013-10-18 14:51:29 +0000 |
174 | +++ quickstart/tests/test_app.py 2013-10-30 11:38:53 +0000 |
175 | @@ -1,5 +1,5 @@ |
176 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
177 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
178 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
179 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
180 | # Copyright (C) 2013 Canonical Ltd. |
181 | # |
182 | # This program is free software: you can redistribute it and/or modify it under |
183 | |
184 | === modified file 'quickstart/tests/test_juju.py' |
185 | --- quickstart/tests/test_juju.py 2013-10-18 16:18:25 +0000 |
186 | +++ quickstart/tests/test_juju.py 2013-10-30 11:38:53 +0000 |
187 | @@ -1,5 +1,5 @@ |
188 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
189 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
190 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
191 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
192 | # Copyright (C) 2013 Canonical Ltd. |
193 | # |
194 | # This program is free software: you can redistribute it and/or modify it under |
195 | |
196 | === modified file 'quickstart/tests/test_manage.py' |
197 | --- quickstart/tests/test_manage.py 2013-10-22 22:03:42 +0000 |
198 | +++ quickstart/tests/test_manage.py 2013-10-30 11:38:53 +0000 |
199 | @@ -1,5 +1,5 @@ |
200 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
201 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
202 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
203 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
204 | # Copyright (C) 2013 Canonical Ltd. |
205 | # |
206 | # This program is free software: you can redistribute it and/or modify it under |
207 | |
208 | === modified file 'quickstart/tests/test_utils.py' |
209 | --- quickstart/tests/test_utils.py 2013-10-22 22:03:42 +0000 |
210 | +++ quickstart/tests/test_utils.py 2013-10-30 11:38:53 +0000 |
211 | @@ -1,5 +1,5 @@ |
212 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
213 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
214 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
215 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
216 | # Copyright (C) 2013 Canonical Ltd. |
217 | # |
218 | # This program is free software: you can redistribute it and/or modify it under |
219 | @@ -306,26 +306,6 @@ |
220 | self.assertEqual('started', agent_state) |
221 | |
222 | |
223 | -class TestUtf8(unittest.TestCase): |
224 | - |
225 | - def test_unicode(self): |
226 | - # A unicode value is correctly converted. |
227 | - value = utils.utf8(u'foo') |
228 | - self.assertIsInstance(value, str) |
229 | - self.assertEqual('foo', value) |
230 | - |
231 | - def test_bytes(self): |
232 | - # A bytes value is left untouched. |
233 | - original = 'foo' |
234 | - value = utils.utf8(original) |
235 | - self.assertIsInstance(value, str) |
236 | - self.assertIs(original, value) |
237 | - |
238 | - def test_none(self): |
239 | - # The None value is returned as is. |
240 | - self.assertIsNone(utils.utf8(None)) |
241 | - |
242 | - |
243 | class TestUnitChanges(unittest.TestCase): |
244 | |
245 | unit = 'django/42' |
246 | @@ -372,3 +352,23 @@ |
247 | self.assertEqual( |
248 | ('unit', 'change', data), |
249 | utils.unit_changes(self.unit, changeset)) |
250 | + |
251 | + |
252 | +class TestUtf8(unittest.TestCase): |
253 | + |
254 | + def test_unicode(self): |
255 | + # A unicode value is correctly converted. |
256 | + value = utils.utf8(u'foo') |
257 | + self.assertIsInstance(value, str) |
258 | + self.assertEqual('foo', value) |
259 | + |
260 | + def test_bytes(self): |
261 | + # A bytes value is left untouched. |
262 | + original = 'foo' |
263 | + value = utils.utf8(original) |
264 | + self.assertIsInstance(value, str) |
265 | + self.assertIs(original, value) |
266 | + |
267 | + def test_none(self): |
268 | + # The None value is returned as is. |
269 | + self.assertIsNone(utils.utf8(None)) |
270 | |
271 | === modified file 'quickstart/utils.py' |
272 | --- quickstart/utils.py 2013-10-22 21:49:26 +0000 |
273 | +++ quickstart/utils.py 2013-10-30 11:38:53 +0000 |
274 | @@ -1,5 +1,5 @@ |
275 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
276 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
277 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
278 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
279 | # Copyright (C) 2013 Canonical Ltd. |
280 | # |
281 | # This program is free software: you can redistribute it and/or modify it under |
282 | @@ -17,10 +17,10 @@ |
283 | """Juju Quickstart utility functions and classes.""" |
284 | |
285 | import collections |
286 | -import re |
287 | +import logging |
288 | import os |
289 | -import logging |
290 | import pipes |
291 | +import re |
292 | import subprocess |
293 | |
294 | import yaml |
295 | @@ -200,16 +200,6 @@ |
296 | return state |
297 | |
298 | |
299 | -def utf8(value): |
300 | - """Return the utf8 encoded version of the given value. |
301 | - |
302 | - The given value is returned as is if already encoded or not a string. |
303 | - """ |
304 | - if isinstance(value, unicode): |
305 | - return value.encode('utf-8') |
306 | - return value |
307 | - |
308 | - |
309 | def unit_changes(unit_name, changeset): |
310 | """Parse the changeset and return the change related to the given unit. |
311 | |
312 | @@ -220,3 +210,13 @@ |
313 | entity, _, data = change |
314 | if entity == 'unit' and data['Name'] == unit_name: |
315 | return change |
316 | + |
317 | + |
318 | +def utf8(value): |
319 | + """Return the utf8 encoded version of the given value. |
320 | + |
321 | + The given value is returned as is if already encoded or not a string. |
322 | + """ |
323 | + if isinstance(value, unicode): |
324 | + return value.encode('utf-8') |
325 | + return value |
326 | |
327 | === modified file 'setup.py' |
328 | --- setup.py 2013-10-14 15:48:41 +0000 |
329 | +++ setup.py 2013-10-30 11:38:53 +0000 |
330 | @@ -1,5 +1,5 @@ |
331 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
332 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
333 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
334 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
335 | # Copyright (C) 2013 Canonical Ltd. |
336 | # |
337 | # This program is free software: you can redistribute it and/or modify it under |
338 | @@ -16,13 +16,13 @@ |
339 | |
340 | """Juju Quickstart distribution file.""" |
341 | |
342 | +import os |
343 | + |
344 | from setuptools import ( |
345 | find_packages, |
346 | setup, |
347 | ) |
348 | |
349 | -import os |
350 | - |
351 | |
352 | ROOT = os.path.abspath(os.path.dirname(__file__)) |
353 | PROJECT_NAME = 'quickstart' |
354 | |
355 | === modified file 'test-requirements.pip' |
356 | --- test-requirements.pip 2013-10-14 15:24:29 +0000 |
357 | +++ test-requirements.pip 2013-10-30 11:38:53 +0000 |
358 | @@ -1,8 +1,8 @@ |
359 | # Juju Quickstart test requirements. |
360 | |
361 | -# This file is part of the Juju GUI, which lets users view and manage Juju |
362 | -# environments within a graphical interface (https://launchpad.net/juju-gui). |
363 | -# Copyright (C) 2012-2013 Canonical Ltd. |
364 | +# This file is part of the Juju Quickstart Plugin, which lets users set up a |
365 | +# Juju environment in very few steps (https://launchpad.net/juju-quickstart). |
366 | +# Copyright (C) 2013 Canonical Ltd. |
367 | # |
368 | # This program is free software: you can redistribute it and/or modify it under |
369 | # the terms of the GNU Affero General Public License version 3, as published by |
Reviewers: mp+193220_ code.launchpad. net,
Message:
Please take a look.
Description:
File header fixes + pep8.
https:/ /code.launchpad .net/~frankban/ juju-quickstart /header- fixes/+ merge/193220
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/19750043/
Affected files (+85, -85 lines): __init_ _.py manage. py tests/_ _init__ .py tests/helpers. py tests/test_ app.py tests/test_ juju.py tests/test_ manage. py tests/test_ utils.py ts.pip
M Makefile
A [revision details]
M juju-quickstart
M quickstart/
M quickstart/app.py
M quickstart/juju.py
M quickstart/
M quickstart/
M quickstart/
M quickstart/
M quickstart/
M quickstart/
M quickstart/
M quickstart/utils.py
M setup.py
M test-requiremen