~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/teststore.py

  • Committer: Aaron Bentley
  • Date: 2005-09-25 05:01:17 UTC
  • mto: (1185.14.1) (1393.1.21)
  • mto: This revision was merged to the branch mainline in revision 1391.
  • Revision ID: aaron.bentley@utoronto.ca-20050925050117-dc4b46505adfc0d7
Added --basis option to bzr branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test Store implementation
18
18
"""
19
 
from bzrlib.store import ImmutableStore
 
19
from bzrlib.store import ImmutableStore, copy_all
 
20
from bzrlib.remotebranch import RemoteStore
20
21
from bzrlib.selftest import TestCaseInTempDir
21
22
from StringIO import StringIO
22
 
from bzrlib.errors import BzrError
 
23
from bzrlib.errors import BzrError, UnlistableStore
 
24
import os
23
25
 
24
26
class TestStore(TestCaseInTempDir):
25
27
    def test_multiple_add(self):
28
30
        store.add(StringIO('goodbye'), '123123')
29
31
        self.assertRaises(BzrError, store.add, StringIO('goodbye'), '123123')
30
32
 
 
33
    def test_copy_all(self):
 
34
        """Test copying"""
 
35
        os.mkdir('a')
 
36
        store_a = ImmutableStore('a')
 
37
        store_a.add('foo', '1')
 
38
        os.mkdir('b')
 
39
        store_b = ImmutableStore('b')
 
40
        copy_all(store_a, store_b)
 
41
        self.assertEqual(store_a['1'].read(), 'foo')
 
42
        self.assertEqual(store_b['1'].read(), 'foo')
 
43
        store_c = RemoteStore('http://example.com/')
 
44
        self.assertRaises(UnlistableStore, copy_all, store_c, store_b)
 
45
        
 
46
 
31
47
TEST_CLASSES = [
32
48
    TestStore,
33
49
    ]