~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-29 02:55:34 UTC
  • mfrom: (1185.1.47)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050929025534-1782933743abbfd5
update with integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test Store implementation
18
18
"""
19
 
from cStringIO import StringIO
20
 
 
21
 
from bzrlib.store import ImmutableStore
 
19
 
 
20
from StringIO import StringIO
 
21
import os
 
22
 
 
23
from bzrlib.store import copy_all, ImmutableStore, RemoteStore
22
24
from bzrlib.selftest import TestCase, TestCaseInTempDir
23
 
from bzrlib.errors import BzrError
 
25
from bzrlib.errors import BzrError, UnlistableStore
24
26
import bzrlib.store
25
27
 
26
28
 
39
41
        # these get gzipped - content should be stable
40
42
        self.assertEqual(store.total_size(), (2, 55))
41
43
        
 
44
    def test_copy_all(self):
 
45
        """Test copying"""
 
46
        os.mkdir('a')
 
47
        store_a = ImmutableStore('a')
 
48
        store_a.add('foo', '1')
 
49
        os.mkdir('b')
 
50
        store_b = ImmutableStore('b')
 
51
        copy_all(store_a, store_b)
 
52
        self.assertEqual(store_a['1'].read(), 'foo')
 
53
        self.assertEqual(store_b['1'].read(), 'foo')
 
54
        store_c = RemoteStore('http://example.com/')
 
55
        self.assertRaises(UnlistableStore, copy_all, store_c, store_b)
 
56
 
42
57
 
43
58
class TestMemoryStore(TestCase):
44
59