~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/teststore.py

  • Committer: Robert Collins
  • Date: 2005-09-28 07:03:54 UTC
  • mfrom: (1185.10.7)
  • mto: (1092.2.19)
  • mto: This revision was merged to the branch mainline in revision 1391.
  • Revision ID: robertc@robertcollins.net-20050928070354-fb49ab0b2563d5b2
Aarons branch --basis patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""
19
19
 
20
20
from StringIO import StringIO
 
21
import os
21
22
 
22
 
from bzrlib.store import ImmutableStore
 
23
from bzrlib.remotebranch import RemoteStore
 
24
from bzrlib.store import ImmutableStore, copy_all
23
25
from bzrlib.selftest import TestCaseInTempDir
24
 
from bzrlib.errors import BzrError
 
26
from bzrlib.errors import BzrError, UnlistableStore
25
27
 
26
28
 
27
29
class TestStore(TestCaseInTempDir):
31
33
        store.add(StringIO('goodbye'), '123123')
32
34
        self.assertRaises(BzrError, store.add, StringIO('goodbye'), '123123')
33
35
 
 
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)
 
48
        
 
49
 
34
50
TEST_CLASSES = [
35
51
    TestStore,
36
52
    ]