bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.160.7
by Martin Albisetti
2009 tests! |
1 |
# Copyright (C) 2008, 2009 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.68
by Vincent Ladeuil
Cleanup some pending changes. |
25 |
config, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
26 |
errors, |
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
27 |
osutils, |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
28 |
remote, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
29 |
revisionspec, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
30 |
tests, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
31 |
transport, |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
32 |
workingtree, |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
33 |
uncommit, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
34 |
)
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
35 |
from bzrlib.smart import server as smart_server |
36 |
from bzrlib.tests import ( |
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
37 |
per_branch, |
38 |
per_transport, |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
39 |
)
|
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
40 |
from bzrlib.transport import ( |
41 |
ftp, |
|
42 |
sftp, |
|
43 |
)
|
|
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
44 |
from bzrlib.plugins import upload |
|
0.152.1
by Vincent Ladeuil
Empty shell |
45 |
|
46 |
||
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
47 |
def get_transport_scenarios(): |
48 |
result = [] |
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
49 |
basis = per_transport.transport_test_permutations() |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
50 |
# Keep only the interesting ones for upload
|
|
0.152.59
by Vincent Ladeuil
Make the test suite pass, but not the nearly empty one :). |
51 |
for name, d in basis: |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
52 |
t_class = d['transport_class'] |
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
53 |
if t_class in (ftp.FtpTransport, sftp.SFTPTransport): |
54 |
result.append((name, d)) |
|
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
55 |
try: |
56 |
import bzrlib.plugins.local_test_server |
|
57 |
from bzrlib.plugins.local_test_server import test_server |
|
58 |
if False: |
|
59 |
# XXX: Disable since we can't get chmod working for anonymous
|
|
60 |
# user
|
|
61 |
scenario = ('vsftpd', |
|
62 |
{'transport_class': test_server.FtpTransport, |
|
63 |
'transport_server': test_server.Vsftpd, |
|
64 |
})
|
|
65 |
result.append(scenario) |
|
66 |
from test_server import ProftpdFeature |
|
67 |
if ProftpdFeature().available(): |
|
68 |
scenario = ('proftpd', |
|
69 |
{'transport_class': test_server.FtpTransport, |
|
70 |
'transport_server': test_server.Proftpd, |
|
71 |
})
|
|
72 |
result.append(scenario) |
|
73 |
# XXX: add support for pyftpdlib
|
|
74 |
except ImportError: |
|
75 |
pass
|
|
76 |
return result |
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
77 |
|
78 |
||
79 |
def load_tests(standard_tests, module, loader): |
|
80 |
"""Multiply tests for tranport implementations.""" |
|
81 |
result = loader.suiteClass() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
82 |
|
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
83 |
# one for each transport implementation
|
84 |
t_tests, remaining_tests = tests.split_suite_by_condition( |
|
85 |
standard_tests, tests.condition_isinstance(( |
|
86 |
TestFullUpload, |
|
87 |
TestIncrementalUpload, |
|
88 |
TestUploadFromRemoteBranch, |
|
89 |
)))
|
|
90 |
tests.multiply_tests(t_tests, get_transport_scenarios(), result) |
|
91 |
||
92 |
# one for each branch format
|
|
93 |
b_tests, remaining_tests = tests.split_suite_by_condition( |
|
94 |
remaining_tests, tests.condition_isinstance(( |
|
95 |
TestBranchUploadLocations, |
|
96 |
)))
|
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
97 |
tests.multiply_tests(b_tests, per_branch.branch_scenarios(), |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
98 |
result) |
99 |
||
100 |
# No parametrization for the remaining tests
|
|
101 |
result.addTests(remaining_tests) |
|
102 |
||
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
103 |
return result |
104 |
||
105 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
106 |
class UploadUtilsMixin(object): |
107 |
"""Helper class to write upload tests. |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
108 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
109 |
This class provides helpers to simplify test writing. The emphasis is on
|
110 |
easy test writing, so each tree modification is committed. This doesn't
|
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
111 |
preclude writing tests spawning several revisions to upload more complex
|
112 |
changes.
|
|
113 |
"""
|
|
114 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
115 |
upload_dir = 'upload' |
116 |
branch_dir = 'branch' |
|
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
117 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
118 |
def make_branch_and_working_tree(self): |
119 |
t = transport.get_transport(self.branch_dir) |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
120 |
t.ensure_base() |
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
121 |
branch = bzrdir.BzrDir.create_branch_convenience( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
122 |
t.base, |
123 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
124 |
force_new_tree=False) |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
125 |
self.tree = branch.bzrdir.create_workingtree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
126 |
self.tree.commit('initial empty tree') |
127 |
||
128 |
def assertUpFileEqual(self, content, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
129 |
self.assertFileEqual(content, osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
130 |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
131 |
def assertUpPathModeEqual(self, path, expected_mode, base=upload_dir): |
132 |
# FIXME: the tests needing that assertion should depend on the server
|
|
133 |
# ability to handle chmod so that they don't fail (or be skipped)
|
|
134 |
# against servers that can't. Note that some bzrlib transports define
|
|
135 |
# _can_roundtrip_unix_modebits in a incomplete way, this property
|
|
136 |
# should depend on both the client and the server, not the client only.
|
|
|
0.152.57
by Vincent Ladeuil
Fix minor 2.4 compatibility bug. |
137 |
# But the client will know or can find if the server support chmod so
|
138 |
# that's the client that will report it anyway.
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
139 |
full_path = osutils.pathjoin(base, path) |
140 |
st = os.stat(full_path) |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
141 |
mode = st.st_mode & 0777 |
142 |
if expected_mode == mode: |
|
143 |
return
|
|
144 |
raise AssertionError( |
|
145 |
'For path %s, mode is %s not %s' % |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
146 |
(full_path, oct(mode), oct(expected_mode))) |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
147 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
148 |
def failIfUpFileExists(self, path, base=upload_dir): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
149 |
self.failIfExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
150 |
|
151 |
def failUnlessUpFileExists(self, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
152 |
self.failUnlessExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
153 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
154 |
def set_file_content(self, path, content, base=branch_dir): |
155 |
f = file(osutils.pathjoin(base, path), 'wb') |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
156 |
try: |
157 |
f.write(content) |
|
158 |
finally: |
|
159 |
f.close() |
|
160 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
161 |
def add_file(self, path, content, base=branch_dir): |
162 |
self.set_file_content(path, content, base) |
|
163 |
self.tree.add(path) |
|
164 |
self.tree.commit('add file %s' % path) |
|
165 |
||
166 |
def modify_file(self, path, content, base=branch_dir): |
|
167 |
self.set_file_content(path, content, base) |
|
168 |
self.tree.commit('modify file %s' % path) |
|
169 |
||
170 |
def chmod_file(self, path, mode, base=branch_dir): |
|
171 |
full_path = osutils.pathjoin(base, path) |
|
172 |
os.chmod(full_path, mode) |
|
173 |
self.tree.commit('change file %s mode to %s' % (path, oct(mode))) |
|
174 |
||
175 |
def delete_any(self, path, base=branch_dir): |
|
176 |
self.tree.remove([path], keep_files=False) |
|
177 |
self.tree.commit('delete %s' % path) |
|
178 |
||
179 |
def add_dir(self, path, base=branch_dir): |
|
180 |
os.mkdir(osutils.pathjoin(base, path)) |
|
181 |
self.tree.add(path) |
|
182 |
self.tree.commit('add directory %s' % path) |
|
183 |
||
184 |
def rename_any(self, old_path, new_path): |
|
185 |
self.tree.rename_one(old_path, new_path) |
|
186 |
self.tree.commit('rename %s into %s' % (old_path, new_path)) |
|
187 |
||
188 |
def transform_dir_into_file(self, path, content, base=branch_dir): |
|
189 |
osutils.delete_any(osutils.pathjoin(base, path)) |
|
190 |
self.set_file_content(path, content, base) |
|
191 |
self.tree.commit('change %s from dir to file' % path) |
|
192 |
||
193 |
def transform_file_into_dir(self, path, base=branch_dir): |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
194 |
# bzr can't handle that kind change in a single commit without an
|
195 |
# intervening bzr status (see bug #205636).
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
196 |
self.tree.remove([path], keep_files=False) |
197 |
os.mkdir(osutils.pathjoin(base, path)) |
|
198 |
self.tree.add(path) |
|
199 |
self.tree.commit('change %s from file to dir' % path) |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
200 |
|
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
201 |
def _get_cmd_upload(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
202 |
cmd = upload.cmd_upload() |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
203 |
# We don't want to use run_bzr here because redirected output are a
|
204 |
# pain to debug. But we need to provides a valid outf.
|
|
205 |
# XXX: Should a bug against bzr be filled about that ?
|
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
206 |
cmd._setup_outf() |
207 |
return cmd |
|
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
208 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
209 |
def do_full_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
210 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
211 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
212 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
213 |
kwargs['directory'] = self.branch_dir |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
214 |
kwargs['full'] = True |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
215 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
216 |
upload.run(up_url, *args, **kwargs) |
217 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
218 |
def do_incremental_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
219 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
220 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
221 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
222 |
kwargs['directory'] = self.branch_dir |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
223 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
224 |
upload.run(up_url, *args, **kwargs) |
225 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
226 |
|
227 |
class TestUploadMixin(UploadUtilsMixin): |
|
228 |
"""Helper class to share tests between full and incremental uploads.""" |
|
229 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
230 |
def test_create_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
231 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
232 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
233 |
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). |
234 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
235 |
self.do_upload() |
236 |
||
237 |
self.assertUpFileEqual('foo', 'hello') |
|
238 |
||
239 |
def test_create_file_in_subdir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
240 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
241 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
242 |
self.add_dir('dir') |
243 |
self.add_file('dir/goodbye', 'baz') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
244 |
|
245 |
self.failIfUpFileExists('dir/goodbye') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
246 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
247 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
248 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
249 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
250 |
self.assertUpPathModeEqual('dir', 0775) |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
251 |
|
252 |
def test_modify_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
253 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
254 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
255 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
256 |
self.modify_file('hello', 'bar') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
257 |
|
258 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
259 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
260 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
261 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
262 |
self.assertUpFileEqual('bar', 'hello') |
263 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
264 |
def test_rename_one_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
265 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
266 |
self.add_file('hello', 'foo') |
|
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.rename_any('hello', 'goodbye') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
269 |
|
270 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
271 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
272 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
273 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
274 |
self.assertUpFileEqual('foo', 'goodbye') |
275 |
||
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
276 |
def test_rename_and_change_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
277 |
self.make_branch_and_working_tree() |
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
278 |
self.add_file('hello', 'foo') |
279 |
self.do_full_upload() |
|
280 |
self.rename_any('hello', 'goodbye') |
|
281 |
self.modify_file('goodbye', 'bar') |
|
282 |
||
283 |
self.assertUpFileEqual('foo', 'hello') |
|
284 |
||
285 |
self.do_upload() |
|
286 |
||
287 |
self.assertUpFileEqual('bar', 'goodbye') |
|
288 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
289 |
def test_rename_two_files(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
290 |
self.make_branch_and_working_tree() |
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
291 |
self.add_file('a', 'foo') |
292 |
self.add_file('b', 'qux') |
|
293 |
self.do_full_upload() |
|
294 |
# We rely on the assumption that bzr will topologically sort the
|
|
295 |
# renames which will cause a -> b to appear *before* b -> c
|
|
296 |
self.rename_any('b', 'c') |
|
297 |
self.rename_any('a', 'b') |
|
298 |
||
299 |
self.assertUpFileEqual('foo', 'a') |
|
300 |
self.assertUpFileEqual('qux', 'b') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
301 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
302 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
303 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
304 |
self.assertUpFileEqual('foo', 'b') |
305 |
self.assertUpFileEqual('qux', 'c') |
|
306 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
307 |
def test_upload_revision(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
308 |
self.make_branch_and_working_tree() # rev1 |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
309 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
310 |
self.add_file('hello', 'foo') # rev2 |
311 |
self.modify_file('hello', 'bar') # rev3 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
312 |
|
313 |
self.failIfUpFileExists('hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
314 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
315 |
revspec = revisionspec.RevisionSpec.from_string('2') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
316 |
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). |
317 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
318 |
self.assertUpFileEqual('foo', 'hello') |
319 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
320 |
def test_no_upload_when_changes(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
321 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
322 |
self.add_file('a', 'foo') |
323 |
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). |
324 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
325 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
326 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
327 |
def test_no_upload_when_conflicts(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
328 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
329 |
self.add_file('a', 'foo') |
330 |
self.run_bzr('branch branch other') |
|
331 |
self.modify_file('a', 'bar') |
|
332 |
other_tree = workingtree.WorkingTree.open('other') |
|
333 |
self.set_file_content('a', 'baz', 'other/') |
|
334 |
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). |
335 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
336 |
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). |
337 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
338 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
339 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
340 |
def test_change_file_into_dir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
341 |
self.make_branch_and_working_tree() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
342 |
self.add_file('hello', 'foo') |
343 |
self.do_full_upload() |
|
344 |
self.transform_file_into_dir('hello') |
|
345 |
self.add_file('hello/file', 'bar') |
|
346 |
||
347 |
self.assertUpFileEqual('foo', 'hello') |
|
348 |
||
349 |
self.do_upload() |
|
350 |
||
351 |
self.assertUpFileEqual('bar', 'hello/file') |
|
352 |
||
353 |
def test_change_dir_into_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
354 |
self.make_branch_and_working_tree() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
355 |
self.add_dir('hello') |
356 |
self.add_file('hello/file', 'foo') |
|
357 |
self.do_full_upload() |
|
358 |
self.delete_any('hello/file') |
|
359 |
self.transform_dir_into_file('hello', 'bar') |
|
360 |
||
361 |
self.assertUpFileEqual('foo', 'hello/file') |
|
362 |
||
363 |
self.do_upload() |
|
364 |
||
365 |
self.assertUpFileEqual('bar', 'hello') |
|
366 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
367 |
def test_make_file_executable(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
368 |
self.make_branch_and_working_tree() |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
369 |
self.add_file('hello', 'foo') |
370 |
self.chmod_file('hello', 0664) |
|
371 |
self.do_full_upload() |
|
372 |
self.chmod_file('hello', 0755) |
|
373 |
||
374 |
self.assertUpPathModeEqual('hello', 0664) |
|
375 |
||
376 |
self.do_upload() |
|
377 |
||
378 |
self.assertUpPathModeEqual('hello', 0775) |
|
379 |
||
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
380 |
def get_upload_auto(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
381 |
return upload.get_upload_auto(self.tree.branch) |
|
0.158.7
by Gary van der Merwe
Clean up white space. |
382 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
383 |
def test_upload_auto(self): |
384 |
"""Test that upload --auto sets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
385 |
self.make_branch_and_working_tree() |
|
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. |
386 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
387 |
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. |
388 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
389 |
self.do_full_upload(auto=True) |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
390 |
self.assertUpFileEqual('foo', 'hello') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
391 |
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. |
392 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
393 |
# and check that it stays set until it is unset
|
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
394 |
self.add_file('bye', 'bar') |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
395 |
self.do_full_upload() |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
396 |
self.assertUpFileEqual('bar', 'bye') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
397 |
self.assertTrue(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
398 |
|
399 |
def test_upload_noauto(self): |
|
400 |
"""Test that upload --no-auto unsets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
401 |
self.make_branch_and_working_tree() |
|
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. |
402 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
403 |
self.add_file('hello', 'foo') |
404 |
self.do_full_upload(auto=True) |
|
405 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
406 |
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. |
407 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
408 |
self.add_file('bye', 'bar') |
409 |
self.do_full_upload(auto=False) |
|
410 |
self.assertUpFileEqual('bar', 'bye') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
411 |
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. |
412 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
413 |
# and check that it stays unset until it is set
|
414 |
self.add_file('again', 'baz') |
|
415 |
self.do_full_upload() |
|
416 |
self.assertUpFileEqual('baz', 'again') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
417 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
418 |
|
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
419 |
def test_upload_from_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
420 |
self.make_branch_and_working_tree() |
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
421 |
self.build_tree(['branch/foo/', 'branch/foo/bar']) |
422 |
self.tree.add(['foo/', 'foo/bar']) |
|
423 |
self.tree.commit("Add directory") |
|
424 |
self.do_full_upload(directory='branch/foo') |
|
425 |
||
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
426 |
def test_upload_revid_path_in_dir(self): |
427 |
self.make_branch_and_working_tree() |
|
428 |
self.add_dir('dir') |
|
429 |
self.add_file('dir/goodbye', 'baz') |
|
430 |
||
431 |
revid_path = 'dir/revid-path' |
|
432 |
upload.set_upload_revid_location(self.tree.branch, revid_path) |
|
433 |
self.failIfUpFileExists(revid_path) |
|
434 |
||
435 |
self.do_full_upload() |
|
436 |
||
437 |
self.add_file('dir/hello', 'foo') |
|
438 |
||
439 |
self.do_upload() |
|
440 |
||
441 |
self.failUnlessUpFileExists(revid_path) |
|
442 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
443 |
self.assertUpFileEqual('foo', 'dir/hello') |
|
444 |
||
|
0.160.1
by Martin Albisetti
Wrote the test first. TDD, dont fail me now. |
445 |
def test_ignore_file(self): |
446 |
self.make_branch_and_working_tree() |
|
447 |
self.do_full_upload() |
|
448 |
self.add_file('.bzrignore-upload','foo') |
|
449 |
self.add_file('foo', 'bar') |
|
450 |
||
451 |
self.do_upload() |
|
452 |
||
453 |
self.failIfUpFileExists('foo') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
454 |
|
|
0.160.11
by Martin Albisetti
Add test for ignoring a dir |
455 |
def test_ignore_directory(self): |
456 |
self.make_branch_and_working_tree() |
|
457 |
self.do_full_upload() |
|
458 |
self.add_file('.bzrignore-upload','dir') |
|
459 |
self.add_dir('dir') |
|
460 |
||
461 |
self.do_upload() |
|
462 |
||
463 |
self.failIfUpFileExists('dir') |
|
464 |
||
|
0.160.4
by Martin Albisetti
Test passes! |
465 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
466 |
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin): |
467 |
||
468 |
do_upload = TestUploadMixin.do_full_upload |
|
469 |
||
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
470 |
def test_full_upload_empty_tree(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
471 |
self.make_branch_and_working_tree() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
472 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
473 |
self.do_full_upload() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
474 |
|
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
475 |
revid_path = upload.get_upload_revid_location(self.tree.branch) |
476 |
self.failUnlessUpFileExists(revid_path) |
|
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
477 |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
478 |
def test_invalid_revspec(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
479 |
self.make_branch_and_working_tree() |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
480 |
rev1 = revisionspec.RevisionSpec.from_string('1') |
481 |
rev2 = revisionspec.RevisionSpec.from_string('2') |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
482 |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
483 |
self.assertRaises(errors.BzrCommandError, |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
484 |
self.do_incremental_upload, revision=[rev1, rev2]) |
485 |
||
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
486 |
def test_create_remote_dir_twice(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
487 |
self.make_branch_and_working_tree() |
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
488 |
self.add_dir('dir') |
489 |
self.do_full_upload() |
|
490 |
self.add_file('dir/goodbye', 'baz') |
|
491 |
||
492 |
self.failIfUpFileExists('dir/goodbye') |
|
493 |
||
494 |
self.do_full_upload() |
|
495 |
||
496 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
497 |
self.assertUpPathModeEqual('dir', 0775) |
|
498 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
499 |
|
500 |
class TestIncrementalUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
501 |
||
502 |
do_upload = TestUploadMixin.do_incremental_upload |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
503 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
504 |
# XXX: full upload doesn't handle deletions....
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
505 |
|
506 |
def test_delete_one_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
507 |
self.make_branch_and_working_tree() |
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
508 |
self.add_file('hello', 'foo') |
509 |
self.do_full_upload() |
|
510 |
self.delete_any('hello') |
|
511 |
||
512 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
513 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
514 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
515 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
516 |
self.failIfUpFileExists('hello') |
517 |
||
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
518 |
def test_delete_dir_and_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
519 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
520 |
self.add_dir('dir') |
521 |
self.add_dir('dir/subdir') |
|
522 |
self.add_file('dir/subdir/a', 'foo') |
|
523 |
self.do_full_upload() |
|
524 |
self.rename_any('dir/subdir/a', 'a') |
|
525 |
self.delete_any('dir/subdir') |
|
526 |
self.delete_any('dir') |
|
527 |
||
528 |
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). |
529 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
530 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
531 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
532 |
self.failIfUpFileExists('dir/subdir/a') |
533 |
self.failIfUpFileExists('dir/subdir') |
|
534 |
self.failIfUpFileExists('dir') |
|
535 |
self.assertUpFileEqual('foo', 'a') |
|
536 |
||
537 |
def test_delete_one_file_rename_to_deleted(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
538 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
539 |
self.add_file('a', 'foo') |
540 |
self.add_file('b', 'bar') |
|
541 |
self.do_full_upload() |
|
542 |
self.delete_any('a') |
|
543 |
self.rename_any('b', 'a') |
|
544 |
||
545 |
self.assertUpFileEqual('foo', 'a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
546 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
547 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
548 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
549 |
self.failIfUpFileExists('b') |
550 |
self.assertUpFileEqual('bar', 'a') |
|
551 |
||
552 |
def test_rename_outside_dir_delete_dir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
553 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
554 |
self.add_dir('dir') |
555 |
self.add_file('dir/a', 'foo') |
|
556 |
self.do_full_upload() |
|
557 |
self.rename_any('dir/a', 'a') |
|
558 |
self.delete_any('dir') |
|
559 |
||
560 |
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). |
561 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
562 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
563 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
564 |
self.failIfUpFileExists('dir/a') |
565 |
self.failIfUpFileExists('dir') |
|
566 |
self.assertUpFileEqual('foo', 'a') |
|
567 |
||
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
568 |
def test_upload_for_the_first_time_do_a_full_upload(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
569 |
self.make_branch_and_working_tree() |
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
570 |
self.add_file('hello', 'bar') |
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
571 |
|
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
572 |
revid_path = upload.get_upload_revid_location(self.tree.branch) |
573 |
self.failIfUpFileExists(revid_path) |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
574 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
575 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
576 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
577 |
self.assertUpFileEqual('bar', 'hello') |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
578 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
579 |
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
580 |
class TestBranchUploadLocations(per_branch.TestCaseWithBranch): |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
581 |
|
582 |
def test_get_upload_location_unset(self): |
|
583 |
config = self.get_branch().get_config() |
|
584 |
self.assertEqual(None, config.get_user_option('upload_location')) |
|
585 |
||
586 |
def test_get_push_location_exact(self): |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
587 |
config.ensure_config_dir_exists() |
588 |
fn = config.locations_config_filename() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
589 |
b = self.get_branch() |
590 |
open(fn, 'wt').write(("[%s]\n" |
|
591 |
"upload_location=foo\n" % |
|
592 |
b.base[:-1])) |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
593 |
conf = b.get_config() |
594 |
self.assertEqual("foo", conf.get_user_option('upload_location')) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
595 |
|
596 |
def test_set_push_location(self): |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
597 |
conf = self.get_branch().get_config() |
598 |
conf.set_user_option('upload_location', 'foo') |
|
599 |
self.assertEqual('foo', conf.get_user_option('upload_location')) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
600 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
601 |
|
602 |
class TestUploadFromRemoteBranch(tests.TestCaseWithTransport, |
|
603 |
UploadUtilsMixin): |
|
604 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
605 |
remote_branch_dir = 'remote_branch' |
606 |
||
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
607 |
def setUp(self): |
608 |
super(TestUploadFromRemoteBranch, self).setUp() |
|
609 |
self.remote_branch_url = self.make_remote_branch_without_working_tree() |
|
610 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
611 |
def make_remote_branch_without_working_tree(self): |
612 |
"""Creates a branch without working tree to upload from. |
|
613 |
||
614 |
It's created from the existing self.branch_dir one which still has its
|
|
615 |
working tree.
|
|
616 |
"""
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
617 |
self.make_branch_and_working_tree() |
618 |
self.add_file('hello', 'foo') |
|
619 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
620 |
remote_branch_url = self.get_url(self.remote_branch_dir) |
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
621 |
if self.transport_server is sftp.SFTPHomeDirServer: |
622 |
# FIXME: Some policy search ends up above the user home directory
|
|
623 |
# and are seen as attemps to escape test isolation
|
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
624 |
raise tests.TestNotApplicable('Escaping test isolation') |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
625 |
self.run_bzr(['push', remote_branch_url, |
626 |
'--directory', self.branch_dir]) |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
627 |
return remote_branch_url |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
628 |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
629 |
def test_no_upload_to_remote_working_tree(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
630 |
cmd = self._get_cmd_upload() |
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
631 |
up_url = self.get_url(self.branch_dir) |
632 |
# Let's try to upload from the just created remote branch into the
|
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
633 |
# branch (which has a working tree).
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
634 |
self.assertRaises(upload.CannotUploadToWorkingTree, |
635 |
cmd.run, up_url, directory=self.remote_branch_url) |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
636 |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
637 |
def test_upload_without_working_tree(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
638 |
self.do_full_upload(directory=self.remote_branch_url) |
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
639 |
self.assertUpFileEqual('foo', 'hello') |
640 |
||
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
641 |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
642 |
class TestUploadDiverged(tests.TestCaseWithTransport, |
643 |
UploadUtilsMixin): |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
644 |
|
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
645 |
def setUp(self): |
646 |
super(TestUploadDiverged, self).setUp() |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
647 |
self.diverged_tree = self.make_diverged_tree_and_upload_location() |
648 |
||
649 |
def make_diverged_tree_and_upload_location(self): |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
650 |
tree_a = self.make_branch_and_tree('tree_a') |
651 |
tree_a.commit('message 1', rev_id='rev1') |
|
652 |
tree_a.commit('message 2', rev_id='rev2a') |
|
653 |
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree() |
|
654 |
uncommit.uncommit(tree_b.branch, tree=tree_b) |
|
655 |
tree_b.commit('message 2', rev_id='rev2b') |
|
656 |
# upload tree a
|
|
657 |
self.do_full_upload(directory=tree_a.basedir) |
|
658 |
return tree_b |
|
659 |
||
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
660 |
def assertRevidUploaded(self, revid): |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
661 |
t = self.get_transport(self.upload_dir) |
662 |
uploaded_revid = t.get_bytes('.bzr-upload.revid') |
|
663 |
self.assertEqual(revid, uploaded_revid) |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
664 |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
665 |
def test_cant_upload_diverged(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
666 |
self.assertRaises(upload.DivergedUploadedTree, |
667 |
self.do_incremental_upload, |
|
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
668 |
directory=self.diverged_tree.basedir) |
669 |
self.assertRevidUploaded('rev2a') |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
670 |
|
671 |
def test_upload_diverged_with_overwrite(self): |
|
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
672 |
self.do_incremental_upload(directory=self.diverged_tree.basedir, |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
673 |
overwrite=True) |
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
674 |
self.assertRevidUploaded('rev2b') |