bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
1 |
# Copyright (C) 2008 Canonical Ltd
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
17 |
import os |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
18 |
import stat |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
19 |
import sys |
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
20 |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
21 |
|
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
22 |
from bzrlib import ( |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
23 |
branch, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
24 |
bzrdir, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
25 |
errors, |
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
26 |
osutils, |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
27 |
remote, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
28 |
revisionspec, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
29 |
tests, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
30 |
transport, |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
31 |
workingtree, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
32 |
)
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
33 |
from bzrlib.smart import server as smart_server |
34 |
||
35 |
from bzrlib.tests import ( |
|
36 |
test_transport_implementations, |
|
37 |
branch_implementations, |
|
38 |
)
|
|
39 |
||
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
40 |
|
|
0.158.9
by Gary van der Merwe
Add a check to make sure we are not uploading to an existing wt. |
41 |
from bzrlib.plugins.upload import ( |
42 |
cmd_upload, |
|
43 |
BzrUploader, |
|
44 |
get_upload_auto, |
|
45 |
CannotUploadToWT, |
|
46 |
)
|
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
47 |
|
48 |
||
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
49 |
class TransportAdapter( |
50 |
test_transport_implementations.TransportTestProviderAdapter): |
|
51 |
"""A tool to generate a suite testing all transports for a single test. |
|
52 |
||
53 |
We restrict the transports to the ones we want to support.
|
|
54 |
"""
|
|
55 |
||
56 |
def _test_permutations(self): |
|
57 |
"""Return a list of the klass, server_factory pairs to test.""" |
|
58 |
result = [] |
|
59 |
transport_modules =['bzrlib.transport.ftp', |
|
60 |
'bzrlib.transport.sftp'] |
|
61 |
for module in transport_modules: |
|
62 |
try: |
|
63 |
permutations = self.get_transport_test_permutations( |
|
64 |
reduce(getattr, (module).split('.')[1:], |
|
65 |
__import__(module))) |
|
66 |
for (klass, server_factory) in permutations: |
|
67 |
scenario = (server_factory.__name__, |
|
68 |
{"transport_class":klass, |
|
69 |
"transport_server":server_factory}) |
|
70 |
result.append(scenario) |
|
71 |
except errors.DependencyNotPresent, e: |
|
72 |
# Continue even if a dependency prevents us
|
|
73 |
# from adding this test
|
|
74 |
pass
|
|
|
0.152.48
by Vincent Ladeuil
Plug tests against proftpd if the local_test_sever plugin is |
75 |
try: |
76 |
import bzrlib.plugins.local_test_server |
|
77 |
from bzrlib.plugins.local_test_server import test_server |
|
78 |
if False: |
|
79 |
# XXX: Disable since we can't get chmod working for anonymous
|
|
80 |
# user
|
|
81 |
scenario = ('vsftpd', |
|
82 |
{'transport_class': test_server.FtpTransport, |
|
83 |
'transport_server': test_server.Vsftpd, |
|
84 |
})
|
|
85 |
result.append(scenario) |
|
86 |
if test_server.ProftpdFeature().available(): |
|
87 |
scenario = ('proftpd', |
|
88 |
{'transport_class': test_server.FtpTransport, |
|
89 |
'transport_server': test_server.Proftpd, |
|
90 |
})
|
|
91 |
result.append(scenario) |
|
92 |
except ImportError: |
|
93 |
pass
|
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
94 |
return result |
95 |
||
96 |
||
97 |
def load_tests(standard_tests, module, loader): |
|
98 |
"""Multiply tests for tranport implementations.""" |
|
99 |
result = loader.suiteClass() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
100 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
101 |
is_testing_for_transports = tests.condition_isinstance( |
102 |
(TestFullUpload, |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
103 |
TestIncrementalUpload, |
104 |
TestFullUploadFromRemote, |
|
105 |
TestIncrementalUploadFromRemote)) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
106 |
transport_adapter = TransportAdapter() |
107 |
||
108 |
is_testing_for_branches = tests.condition_isinstance( |
|
109 |
(TestBranchUploadLocations,)) |
|
110 |
# Generate a list of branch formats and their associated bzrdir formats to
|
|
111 |
# use.
|
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
112 |
# XXX: This was copied from bzrlib.tests.branch_implementations.tests_suite
|
113 |
# and need to be shared in a better way.
|
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
114 |
combinations = [(format, format._matchingbzrdir) for format in |
115 |
branch.BranchFormat._formats.values() + branch._legacy_formats] |
|
116 |
BTPA = branch_implementations.BranchTestProviderAdapter |
|
117 |
branch_adapter = BTPA( |
|
118 |
# None here will cause the default vfs transport server to be used.
|
|
119 |
None, |
|
120 |
# None here will cause a readonly decorator to be created
|
|
121 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
122 |
None, |
|
123 |
combinations) |
|
124 |
branch_adapter_for_ss = BTPA( |
|
125 |
smart_server.SmartTCPServer_for_testing, |
|
126 |
smart_server.ReadonlySmartTCPServer_for_testing, |
|
127 |
[(remote.RemoteBranchFormat(), remote.RemoteBzrDirFormat())], |
|
128 |
# XXX: Report to bzr list, this parameter is not used in the
|
|
129 |
# constructor
|
|
130 |
||
131 |
# MemoryServer
|
|
132 |
)
|
|
133 |
||
134 |
for test_class in tests.iter_suite_tests(standard_tests): |
|
135 |
# Each test class is either standalone or testing for some combination
|
|
136 |
# of transport or branch. Use the right adpater (or none) depending on
|
|
137 |
# the class.
|
|
138 |
if is_testing_for_transports(test_class): |
|
139 |
result.addTests(transport_adapter.adapt(test_class)) |
|
140 |
elif is_testing_for_branches(test_class): |
|
141 |
result.addTests(branch_adapter.adapt(test_class)) |
|
142 |
result.addTests(branch_adapter_for_ss.adapt(test_class)) |
|
143 |
else: |
|
144 |
result.addTest(test_class) |
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
145 |
return result |
146 |
||
147 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
148 |
class TestUploadMixin(object): |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
149 |
"""Helper class to share tests between full and incremental uploads. |
150 |
||
151 |
This class also provides helpers to simplify test writing. The emphasis is
|
|
152 |
on easy test writing, so each tree modification is committed. This doesn't
|
|
153 |
preclude writing tests spawning several revisions to upload more complex
|
|
154 |
changes.
|
|
155 |
"""
|
|
156 |
||
157 |
upload_dir = 'upload/' |
|
158 |
branch_dir = 'branch/' |
|
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
159 |
|
|
0.152.10
by Vincent Ladeuil
Fix incremental upload cheat. |
160 |
def make_local_branch(self): |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
161 |
t = transport.get_transport('branch') |
162 |
t.ensure_base() |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
163 |
branch = bzrdir.BzrDir.create_branch_convenience( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
164 |
t.base, |
165 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
166 |
force_new_tree=False) |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
167 |
self.tree = branch.bzrdir.create_workingtree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
168 |
self.tree.commit('initial empty tree') |
169 |
||
170 |
def assertUpFileEqual(self, content, path, base=upload_dir): |
|
171 |
self.assertFileEqual(content, base + path) |
|
172 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
173 |
def assertUpPathModeEqual(self, path, expected_mode, base=upload_dir): |
174 |
# FIXME: the tests needing that assertion should depend on the server
|
|
175 |
# ability to handle chmod so that they don't fail (or be skipped)
|
|
176 |
# against servers that can't. Note that some bzrlib transports define
|
|
177 |
# _can_roundtrip_unix_modebits in a incomplete way, this property
|
|
178 |
# should depend on both the client and the server, not the client only.
|
|
179 |
st = os.stat(base + path) |
|
180 |
mode = st.st_mode & 0777 |
|
181 |
if expected_mode == mode: |
|
182 |
return
|
|
183 |
raise AssertionError( |
|
184 |
'For path %s, mode is %s not %s' % |
|
185 |
(base + path, oct(mode), oct(expected_mode))) |
|
186 |
||
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
187 |
def failIfUpFileExists(self, path, base=upload_dir): |
188 |
self.failIfExists(base + path) |
|
189 |
||
190 |
def failUnlessUpFileExists(self, path, base=upload_dir): |
|
191 |
self.failUnlessExists(base + path) |
|
192 |
||
193 |
def set_file_content(self, name, content, base=branch_dir): |
|
194 |
f = file(base + name, 'wb') |
|
195 |
try: |
|
196 |
f.write(content) |
|
197 |
finally: |
|
198 |
f.close() |
|
199 |
||
200 |
def add_file(self, name, content, base=branch_dir): |
|
201 |
self.set_file_content(name, content, base) |
|
202 |
self.tree.add(name) |
|
203 |
self.tree.commit('add file %s' % name) |
|
204 |
||
205 |
def modify_file(self, name, content, base=branch_dir): |
|
206 |
self.set_file_content(name, content, base) |
|
207 |
self.tree.commit('modify file %s' % name) |
|
208 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
209 |
def chmod_file(self, name, mode, base=branch_dir): |
210 |
path = base + name |
|
211 |
os.chmod(path, mode) |
|
212 |
self.tree.commit('change file %s mode to %s' % (name, oct(mode))) |
|
213 |
||
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
214 |
def delete_any(self, name, base=branch_dir): |
215 |
self.tree.remove([name], keep_files=False) |
|
216 |
self.tree.commit('delete %s' % name) |
|
217 |
||
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
218 |
def add_dir(self, name, base=branch_dir): |
219 |
os.mkdir(base + name) |
|
220 |
self.tree.add(name) |
|
221 |
self.tree.commit('add directory %s' % name) |
|
222 |
||
223 |
def rename_any(self, old_name, new_name): |
|
224 |
self.tree.rename_one(old_name, new_name) |
|
225 |
self.tree.commit('rename %s into %s' % (old_name, new_name)) |
|
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
226 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
227 |
def transform_dir_into_file(self, name, content, base=branch_dir): |
228 |
osutils.delete_any(base + name) |
|
229 |
self.set_file_content(name, content, base) |
|
230 |
self.tree.commit('change %s from dir to file' % name) |
|
231 |
||
232 |
def transform_file_into_dir(self, name, base=branch_dir): |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
233 |
# bzr can't handle that kind change in a single commit without an
|
234 |
# intervening bzr status (see bug #205636).
|
|
235 |
self.tree.remove([name], keep_files=False) |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
236 |
os.mkdir(base + name) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
237 |
self.tree.add(name) |
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
238 |
self.tree.commit('change %s from file to dir' % name) |
239 |
||
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
240 |
def _get_cmd_upload(self): |
241 |
upload = cmd_upload() |
|
242 |
# We don't want to use run_bzr here because redirected output are a
|
|
243 |
# pain to debug. But we need to provides a valid outf.
|
|
244 |
# XXX: Should a bug against bzr be filled about that ?
|
|
245 |
upload._setup_outf() |
|
246 |
return upload |
|
247 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
248 |
def do_full_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
249 |
upload = self._get_cmd_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
250 |
up_url = self.get_transport(self.upload_dir).external_url() |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
251 |
if kwargs.get('directory', None) is None: |
252 |
kwargs['directory'] = 'branch' |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
253 |
kwargs['full'] = True |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
254 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
255 |
upload.run(up_url, *args, **kwargs) |
256 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
257 |
def do_incremental_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
258 |
upload = self._get_cmd_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
259 |
up_url = self.get_transport(self.upload_dir).external_url() |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
260 |
if kwargs.get('directory', None) is None: |
261 |
kwargs['directory'] = 'branch' |
|
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
262 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
263 |
upload.run(up_url, *args, **kwargs) |
264 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
265 |
def test_create_file(self): |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
266 |
self.make_local_branch() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
267 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
268 |
self.add_file('hello', 'foo') |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
269 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
270 |
self.do_upload() |
271 |
||
272 |
self.assertUpFileEqual('foo', 'hello') |
|
273 |
||
274 |
def test_create_file_in_subdir(self): |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
275 |
self.make_local_branch() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
276 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
277 |
self.add_dir('dir') |
278 |
self.add_file('dir/goodbye', 'baz') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
279 |
|
280 |
self.failIfUpFileExists('dir/goodbye') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
281 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
282 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
283 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
284 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
285 |
self.assertUpPathModeEqual('dir', 0775) |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
286 |
|
287 |
def test_modify_file(self): |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
288 |
self.make_local_branch() |
289 |
self.add_file('hello', 'foo') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
290 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
291 |
self.modify_file('hello', 'bar') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
292 |
|
293 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
294 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
295 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
296 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
297 |
self.assertUpFileEqual('bar', 'hello') |
298 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
299 |
def test_rename_one_file(self): |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
300 |
self.make_local_branch() |
301 |
self.add_file('hello', 'foo') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
302 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
303 |
self.rename_any('hello', 'goodbye') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
304 |
|
305 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
306 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
307 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
308 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
309 |
self.assertUpFileEqual('foo', 'goodbye') |
310 |
||
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
311 |
def test_rename_and_change_file(self): |
312 |
self.make_local_branch() |
|
313 |
self.add_file('hello', 'foo') |
|
314 |
self.do_full_upload() |
|
315 |
self.rename_any('hello', 'goodbye') |
|
316 |
self.modify_file('goodbye', 'bar') |
|
317 |
||
318 |
self.assertUpFileEqual('foo', 'hello') |
|
319 |
||
320 |
self.do_upload() |
|
321 |
||
322 |
self.assertUpFileEqual('bar', 'goodbye') |
|
323 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
324 |
def test_rename_two_files(self): |
325 |
self.make_local_branch() |
|
326 |
self.add_file('a', 'foo') |
|
327 |
self.add_file('b', 'qux') |
|
328 |
self.do_full_upload() |
|
329 |
# We rely on the assumption that bzr will topologically sort the
|
|
330 |
# renames which will cause a -> b to appear *before* b -> c
|
|
331 |
self.rename_any('b', 'c') |
|
332 |
self.rename_any('a', 'b') |
|
333 |
||
334 |
self.assertUpFileEqual('foo', 'a') |
|
335 |
self.assertUpFileEqual('qux', 'b') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
336 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
337 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
338 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
339 |
self.assertUpFileEqual('foo', 'b') |
340 |
self.assertUpFileEqual('qux', 'c') |
|
341 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
342 |
def test_upload_revision(self): |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
343 |
self.make_local_branch() # rev1 |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
344 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
345 |
self.add_file('hello', 'foo') # rev2 |
346 |
self.modify_file('hello', 'bar') # rev3 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
347 |
|
348 |
self.failIfUpFileExists('hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
349 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
350 |
revspec = revisionspec.RevisionSpec.from_string('2') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
351 |
self.do_upload(revision=[revspec]) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
352 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
353 |
self.assertUpFileEqual('foo', 'hello') |
354 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
355 |
def test_no_upload_when_changes(self): |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
356 |
self.make_local_branch() |
357 |
self.add_file('a', 'foo') |
|
358 |
self.set_file_content('a', 'bar') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
359 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
360 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
361 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
362 |
def test_no_upload_when_conflicts(self): |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
363 |
self.make_local_branch() |
364 |
self.add_file('a', 'foo') |
|
365 |
self.run_bzr('branch branch other') |
|
366 |
self.modify_file('a', 'bar') |
|
367 |
other_tree = workingtree.WorkingTree.open('other') |
|
368 |
self.set_file_content('a', 'baz', 'other/') |
|
369 |
other_tree.commit('modify file a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
370 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
371 |
self.run_bzr('merge -d branch other', retcode=1) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
372 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
373 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
374 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
375 |
def test_change_file_into_dir(self): |
376 |
self.make_local_branch() |
|
377 |
self.add_file('hello', 'foo') |
|
378 |
self.do_full_upload() |
|
379 |
self.transform_file_into_dir('hello') |
|
380 |
self.add_file('hello/file', 'bar') |
|
381 |
||
382 |
self.assertUpFileEqual('foo', 'hello') |
|
383 |
||
384 |
self.do_upload() |
|
385 |
||
386 |
self.assertUpFileEqual('bar', 'hello/file') |
|
387 |
||
388 |
def test_change_dir_into_file(self): |
|
389 |
self.make_local_branch() |
|
390 |
self.add_dir('hello') |
|
391 |
self.add_file('hello/file', 'foo') |
|
392 |
self.do_full_upload() |
|
393 |
self.delete_any('hello/file') |
|
394 |
self.transform_dir_into_file('hello', 'bar') |
|
395 |
||
396 |
self.assertUpFileEqual('foo', 'hello/file') |
|
397 |
||
398 |
self.do_upload() |
|
399 |
||
400 |
self.assertUpFileEqual('bar', 'hello') |
|
401 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
402 |
def test_make_file_executable(self): |
403 |
self.make_local_branch() |
|
404 |
self.add_file('hello', 'foo') |
|
405 |
self.chmod_file('hello', 0664) |
|
406 |
self.do_full_upload() |
|
407 |
self.chmod_file('hello', 0755) |
|
408 |
||
409 |
self.assertUpPathModeEqual('hello', 0664) |
|
410 |
||
411 |
self.do_upload() |
|
412 |
||
413 |
self.assertUpPathModeEqual('hello', 0775) |
|
414 |
||
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
415 |
def get_upload_auto(self): |
416 |
return get_upload_auto(self.tree.branch) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
417 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
418 |
def test_upload_auto(self): |
419 |
"""Test that upload --auto sets the upload_auto option""" |
|
420 |
self.make_local_branch() |
|
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
421 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
422 |
self.add_file('hello', 'foo') |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
423 |
self.do_full_upload() |
424 |
self.assertUpFileEqual('foo', 'hello') |
|
425 |
self.assertFalse(self.get_upload_auto()) |
|
426 |
||
427 |
self.add_file('bye', 'bar') |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
428 |
self.do_full_upload(auto=True) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
429 |
self.assertUpFileEqual('bar', 'bye') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
430 |
self.assertTrue(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
431 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
432 |
# and check that it stays set until it is unset
|
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
433 |
self.add_file('again', 'baz') |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
434 |
self.do_full_upload() |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
435 |
self.assertUpFileEqual('baz', 'again') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
436 |
self.assertTrue(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
437 |
|
438 |
def test_upload_noauto(self): |
|
439 |
"""Test that upload --no-auto unsets the upload_auto option""" |
|
440 |
self.make_local_branch() |
|
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
441 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
442 |
self.add_file('hello', 'foo') |
443 |
self.do_full_upload(auto=True) |
|
444 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
445 |
self.assertTrue(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
446 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
447 |
self.add_file('bye', 'bar') |
448 |
self.do_full_upload(auto=False) |
|
449 |
self.assertUpFileEqual('bar', 'bye') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
450 |
self.assertFalse(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
451 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
452 |
# and check that it stays unset until it is set
|
453 |
self.add_file('again', 'baz') |
|
454 |
self.do_full_upload() |
|
455 |
self.assertUpFileEqual('baz', 'again') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
456 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
457 |
|
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
458 |
def test_upload_from_subdir(self): |
459 |
self.make_local_branch() |
|
460 |
self.build_tree(['branch/foo/', 'branch/foo/bar']) |
|
461 |
self.tree.add(['foo/', 'foo/bar']) |
|
462 |
self.tree.commit("Add directory") |
|
463 |
self.do_full_upload(directory='branch/foo') |
|
464 |
||
|
0.158.9
by Gary van der Merwe
Add a check to make sure we are not uploading to an existing wt. |
465 |
def test_no_upload_remote_wt(self): |
466 |
self.make_local_branch() |
|
467 |
self.add_file('hello', 'foo') |
|
468 |
||
469 |
#Create branch in remote tree to create wt
|
|
470 |
t = transport.get_transport(self.upload_dir) |
|
471 |
self.branch = bzrdir.BzrDir.create_branch_convenience( |
|
472 |
t.base, |
|
473 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
474 |
force_new_tree=True) |
|
475 |
||
476 |
self.assertRaises(CannotUploadToWT, self.do_upload) |
|
477 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
478 |
|
479 |
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
480 |
||
481 |
do_upload = TestUploadMixin.do_full_upload |
|
482 |
||
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
483 |
def test_full_upload_empty_tree(self): |
484 |
self.make_local_branch() |
|
485 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
486 |
self.do_full_upload() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
487 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
488 |
self.failUnlessUpFileExists(BzrUploader.bzr_upload_revid_file_name) |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
489 |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
490 |
def test_invalid_revspec(self): |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
491 |
self.make_local_branch() |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
492 |
rev1 = revisionspec.RevisionSpec.from_string('1') |
493 |
rev2 = revisionspec.RevisionSpec.from_string('2') |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
494 |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
495 |
self.assertRaises(errors.BzrCommandError, |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
496 |
self.do_incremental_upload, revision=[rev1, rev2]) |
497 |
||
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
498 |
def test_create_remote_dir_twice(self): |
499 |
self.make_local_branch() |
|
500 |
self.add_dir('dir') |
|
501 |
self.do_full_upload() |
|
502 |
self.add_file('dir/goodbye', 'baz') |
|
503 |
||
504 |
self.failIfUpFileExists('dir/goodbye') |
|
505 |
||
506 |
self.do_full_upload() |
|
507 |
||
508 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
509 |
self.assertUpPathModeEqual('dir', 0775) |
|
510 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
511 |
|
512 |
class TestIncrementalUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
513 |
||
514 |
do_upload = TestUploadMixin.do_incremental_upload |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
515 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
516 |
# XXX: full upload doesn't handle deletions....
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
517 |
|
518 |
def test_delete_one_file(self): |
|
519 |
self.make_local_branch() |
|
520 |
self.add_file('hello', 'foo') |
|
521 |
self.do_full_upload() |
|
522 |
self.delete_any('hello') |
|
523 |
||
524 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
525 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
526 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
527 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
528 |
self.failIfUpFileExists('hello') |
529 |
||
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
530 |
def test_delete_dir_and_subdir(self): |
531 |
self.make_local_branch() |
|
532 |
self.add_dir('dir') |
|
533 |
self.add_dir('dir/subdir') |
|
534 |
self.add_file('dir/subdir/a', 'foo') |
|
535 |
self.do_full_upload() |
|
536 |
self.rename_any('dir/subdir/a', 'a') |
|
537 |
self.delete_any('dir/subdir') |
|
538 |
self.delete_any('dir') |
|
539 |
||
540 |
self.assertUpFileEqual('foo', 'dir/subdir/a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
541 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
542 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
543 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
544 |
self.failIfUpFileExists('dir/subdir/a') |
545 |
self.failIfUpFileExists('dir/subdir') |
|
546 |
self.failIfUpFileExists('dir') |
|
547 |
self.assertUpFileEqual('foo', 'a') |
|
548 |
||
549 |
def test_delete_one_file_rename_to_deleted(self): |
|
550 |
self.make_local_branch() |
|
551 |
self.add_file('a', 'foo') |
|
552 |
self.add_file('b', 'bar') |
|
553 |
self.do_full_upload() |
|
554 |
self.delete_any('a') |
|
555 |
self.rename_any('b', 'a') |
|
556 |
||
557 |
self.assertUpFileEqual('foo', 'a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
558 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
559 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
560 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
561 |
self.failIfUpFileExists('b') |
562 |
self.assertUpFileEqual('bar', 'a') |
|
563 |
||
564 |
def test_rename_outside_dir_delete_dir(self): |
|
565 |
self.make_local_branch() |
|
566 |
self.add_dir('dir') |
|
567 |
self.add_file('dir/a', 'foo') |
|
568 |
self.do_full_upload() |
|
569 |
self.rename_any('dir/a', 'a') |
|
570 |
self.delete_any('dir') |
|
571 |
||
572 |
self.assertUpFileEqual('foo', 'dir/a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
573 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
574 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
575 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
576 |
self.failIfUpFileExists('dir/a') |
577 |
self.failIfUpFileExists('dir') |
|
578 |
self.assertUpFileEqual('foo', 'a') |
|
579 |
||
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
580 |
def test_upload_for_the_first_time_do_a_full_upload(self): |
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
581 |
self.make_local_branch() |
582 |
self.add_file('hello', 'bar') |
|
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
583 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
584 |
self.failIfUpFileExists(BzrUploader.bzr_upload_revid_file_name) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
585 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
586 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
587 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
588 |
self.assertUpFileEqual('bar', 'hello') |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
589 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
590 |
class TestUploadFromRemote(TestUploadMixin): |
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
591 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
592 |
def do_full_upload(self, *args, **kwargs): |
|
0.158.15
by Vincent Ladeuil
Just use run_bzr to push. |
593 |
up_url = self.get_url(self.upload_dir) |
594 |
self.run_bzr(['push', up_url, '--directory=branch']) |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
595 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
596 |
upload = self._get_cmd_upload() |
597 |
if kwargs.get('directory', None) is None: |
|
598 |
kwargs['directory'] = up_url |
|
599 |
kwargs['full'] = True |
|
600 |
kwargs['quiet'] = True |
|
601 |
upload.run(up_url, *args, **kwargs) |
|
602 |
||
603 |
def do_incremental_upload(self, *args, **kwargs): |
|
|
0.158.15
by Vincent Ladeuil
Just use run_bzr to push. |
604 |
up_url = self.get_url(self.upload_dir) |
605 |
self.run_bzr(['push', up_url, '--directory=branch']) |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
606 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
607 |
upload = self._get_cmd_upload() |
608 |
if kwargs.get('directory', None) is None: |
|
609 |
kwargs['directory'] = up_url |
|
610 |
kwargs['quiet'] = True |
|
611 |
upload.run(up_url, *args, **kwargs) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
612 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
613 |
def test_no_upload_when_changes(self): |
614 |
raise tests.TestNotApplicable() |
|
615 |
||
616 |
def test_no_upload_when_conflicts(self): |
|
617 |
raise tests.TestNotApplicable() |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
618 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
619 |
remote_branch = None |
620 |
def get_upload_auto(self): |
|
621 |
if not self.remote_branch: |
|
622 |
self.remote_branch = branch.Branch.open_from_transport(\ |
|
623 |
self.get_transport(self.upload_dir)) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
624 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
625 |
return get_upload_auto(self.remote_branch) |
626 |
||
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
627 |
|
628 |
class TestFullUploadFromRemote(tests.TestCaseWithTransport, |
|
629 |
TestUploadFromRemote): |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
630 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
631 |
do_upload = TestUploadFromRemote.do_full_upload |
632 |
||
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
633 |
|
634 |
class TestIncrementalUploadFromRemote(tests.TestCaseWithTransport, |
|
635 |
TestUploadFromRemote): |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
636 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
637 |
do_upload = TestUploadFromRemote.do_incremental_upload |
|
0.153.1
by Vincent Ladeuil
Clean up references to verbose. |
638 |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
639 |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
640 |
class TestBranchUploadLocations(branch_implementations.TestCaseWithBranch): |
641 |
||
642 |
def test_get_upload_location_unset(self): |
|
643 |
config = self.get_branch().get_config() |
|
644 |
self.assertEqual(None, config.get_user_option('upload_location')) |
|
645 |
||
646 |
def test_get_push_location_exact(self): |
|
647 |
from bzrlib.config import (locations_config_filename, |
|
648 |
ensure_config_dir_exists) |
|
649 |
ensure_config_dir_exists() |
|
650 |
fn = locations_config_filename() |
|
651 |
b = self.get_branch() |
|
652 |
open(fn, 'wt').write(("[%s]\n" |
|
653 |
"upload_location=foo\n" % |
|
654 |
b.base[:-1])) |
|
655 |
config = b.get_config() |
|
656 |
self.assertEqual("foo", config.get_user_option('upload_location')) |
|
657 |
||
658 |
def test_set_push_location(self): |
|
659 |
config = self.get_branch().get_config() |
|
660 |
config.set_user_option('upload_location', 'foo') |
|
661 |
self.assertEqual('foo', config.get_user_option('upload_location')) |
|
662 |