1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
1 |
# -*- coding: utf-8 -*-
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
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 |
||
18 |
"""Black-box tests for bzr export.
|
|
19 |
"""
|
|
20 |
||
21 |
import os |
|
22 |
||
23 |
from bzrlib.branch import Branch |
|
24 |
from bzrlib.tests.blackbox import ExternalBase |
|
25 |
import tarfile, zipfile |
|
26 |
||
27 |
class TestExport(ExternalBase): |
|
28 |
||
29 |
def test_tar_export(self): |
|
30 |
||
31 |
os.mkdir('tar') |
|
32 |
os.chdir('tar') |
|
33 |
||
34 |
self.runbzr('init') |
|
35 |
open('a', 'wb').write('foo\n') |
|
36 |
self.runbzr('add a') |
|
37 |
self.runbzr('ignore something') |
|
38 |
self.runbzr('commit -m 1') |
|
39 |
self.runbzr('export test.tar.gz') |
|
40 |
ball = tarfile.open('test.tar.gz') |
|
41 |
for m in ball.getnames(): |
|
42 |
#print m
|
|
43 |
self.failIf(os.path.basename(m) == '.bzrignore', 'tar export contains .bzrignore') |
|
44 |
||
45 |
def test_zip_export(self): |
|
46 |
||
47 |
os.mkdir('zip') |
|
48 |
os.chdir('zip') |
|
49 |
||
50 |
self.runbzr('init') |
|
51 |
open('a', 'wb').write('foo\n') |
|
52 |
self.runbzr('add a') |
|
53 |
self.runbzr('ignore something') |
|
54 |
self.runbzr('commit -m 1') |
|
55 |
self.runbzr('export test.zip') |
|
56 |
ball = zipfile.ZipFile('test.zip') |
|
57 |
for m in ball.namelist(): |
|
58 |
#print m
|
|
59 |
self.failIf(os.path.basename(m) == '.bzrignore', 'zip export contains .bzrignore') |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
60 |
|
61 |
def test_dir_export(self): |
|
62 |
||
63 |
os.mkdir('dir') |
|
64 |
os.chdir('dir') |
|
65 |
||
66 |
self.runbzr('init') |
|
67 |
open('a', 'wb').write('foo\n') |
|
68 |
self.runbzr('add a') |
|
69 |
self.runbzr('ignore something') |
|
70 |
self.runbzr('commit -m 1') |
|
71 |
self.runbzr('export direxport') |
|
72 |
||
73 |
files = sorted(os.listdir('direxport')) |
|
74 |
self.assertEqual(['a'], files, 'dir contains .bzrignore') |