bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
1 |
# Copyright (C) 2008, 2009, 2011, 2012 Canonical Ltd
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
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 |
||
17 |
import os |
|
18 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
19 |
from .... import ( |
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
20 |
tests, |
21 |
)
|
|
22 |
||
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
23 |
from ... import ( |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
24 |
upload, |
25 |
)
|
|
|
6645.2.1
by Jelmer Vernooij
Bundle the upload plugin. |
26 |
from .. import ( |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
27 |
cmds, |
28 |
)
|
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
29 |
|
30 |
||
31 |
class AutoPushHookTests(tests.TestCaseWithTransport): |
|
32 |
||
33 |
def setUp(self): |
|
34 |
super(AutoPushHookTests, self).setUp() |
|
35 |
upload.install_auto_upload_hook() |
|
36 |
||
37 |
def make_start_branch(self): |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
38 |
self.wt = self.make_branch_and_tree('.') |
39 |
self.build_tree(['a']) |
|
40 |
self.wt.add(['a']) |
|
41 |
self.wt.commit("one") |
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
42 |
|
43 |
||
44 |
class AutoPushWithLocation(AutoPushHookTests): |
|
45 |
||
46 |
def setUp(self): |
|
47 |
super(AutoPushWithLocation, self).setUp() |
|
48 |
self.make_start_branch() |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
49 |
conf = self.wt.branch.get_config_stack() |
50 |
conf.set('upload_auto', True) |
|
51 |
conf.set('upload_location', self.get_url('target')) |
|
52 |
conf.set('upload_auto_quiet', True) |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
53 |
|
54 |
def test_auto_push_on_commit(self): |
|
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
55 |
self.assertPathDoesNotExist('target') |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
56 |
self.build_tree(['b']) |
57 |
self.wt.add(['b']) |
|
58 |
self.wt.commit("two") |
|
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
59 |
self.assertPathExists('target') |
60 |
self.assertPathExists(os.path.join('target', 'a')) |
|
61 |
self.assertPathExists(os.path.join('target', 'b')) |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
62 |
|
63 |
def test_disable_auto_push(self): |
|
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
64 |
self.assertPathDoesNotExist('target') |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
65 |
self.build_tree(['b']) |
66 |
self.wt.add(['b']) |
|
67 |
self.wt.commit("two") |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
68 |
self.wt.branch.get_config_stack().set('upload_auto', False) |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
69 |
self.build_tree(['c']) |
70 |
self.wt.add(['c']) |
|
71 |
self.wt.commit("three") |
|
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
72 |
self.assertPathDoesNotExist(os.path.join('target', 'c')) |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
73 |
|
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
74 |
|
75 |
class AutoPushWithoutLocation(AutoPushHookTests): |
|
76 |
||
77 |
def setUp(self): |
|
78 |
super(AutoPushWithoutLocation, self).setUp() |
|
79 |
self.make_start_branch() |
|
|
0.152.93
by Vincent Ladeuil
Migrate to config stacks |
80 |
self.wt.branch.get_config_stack().set('upload_auto', True) |
|
0.152.61
by Vincent Ladeuil
Fix bug #312686 and add an 'upload_auto_quiet' config variable. |
81 |
|
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
82 |
def test_dont_push_if_no_location(self): |
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
83 |
self.assertPathDoesNotExist('target') |
|
0.155.3
by James Westby
Add some tests for the hook, rename the option to "upload_auto" |
84 |
self.build_tree(['b']) |
85 |
self.wt.add(['b']) |
|
86 |
self.wt.commit("two") |
|
|
0.152.86
by Vincent Ladeuil
Get rid of the deprecation warnings while running the test suite |
87 |
self.assertPathDoesNotExist('target') |