974.1.44
by aaron.bentley at utoronto
Added test of double-add in ImmutableStore |
1 |
# Copyright (C) 2005 by Canonical Development Ltd
|
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 |
"""Test Store implementation
|
|
18 |
"""
|
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
19 |
|
20 |
from StringIO import StringIO |
|
1185.1.46
by Robert Collins
Aarons branch --basis patch |
21 |
import os |
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
22 |
|
1185.1.46
by Robert Collins
Aarons branch --basis patch |
23 |
from bzrlib.remotebranch import RemoteStore |
1185.10.1
by Aaron Bentley
Added --basis option to bzr branch |
24 |
from bzrlib.store import ImmutableStore, copy_all |
974.1.52
by aaron.bentley at utoronto
Merged mpool's latest changes (~0.0.7) |
25 |
from bzrlib.selftest import TestCaseInTempDir |
1185.10.1
by Aaron Bentley
Added --basis option to bzr branch |
26 |
from bzrlib.errors import BzrError, UnlistableStore |
974.1.44
by aaron.bentley at utoronto
Added test of double-add in ImmutableStore |
27 |
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
28 |
|
974.1.52
by aaron.bentley at utoronto
Merged mpool's latest changes (~0.0.7) |
29 |
class TestStore(TestCaseInTempDir): |
974.1.44
by aaron.bentley at utoronto
Added test of double-add in ImmutableStore |
30 |
def test_multiple_add(self): |
31 |
"""Multiple add with same ID should raise a BzrError"""
|
|
32 |
store = ImmutableStore('.') |
|
33 |
store.add(StringIO('goodbye'), '123123') |
|
34 |
self.assertRaises(BzrError, store.add, StringIO('goodbye'), '123123') |
|
35 |
||
1185.10.1
by Aaron Bentley
Added --basis option to bzr branch |
36 |
def test_copy_all(self): |
37 |
"""Test copying"""
|
|
38 |
os.mkdir('a') |
|
39 |
store_a = ImmutableStore('a') |
|
40 |
store_a.add('foo', '1') |
|
41 |
os.mkdir('b') |
|
42 |
store_b = ImmutableStore('b') |
|
43 |
copy_all(store_a, store_b) |
|
44 |
self.assertEqual(store_a['1'].read(), 'foo') |
|
45 |
self.assertEqual(store_b['1'].read(), 'foo') |
|
46 |
store_c = RemoteStore('http://example.com/') |
|
47 |
self.assertRaises(UnlistableStore, copy_all, store_c, store_b) |