~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_store.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Development Ltd
2
 
 
 
1
# Copyright (C) 2005 Canonical Ltd
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38
38
        f = store.get(fileid)
39
39
        self.assertEqual(f.read(), value)
40
40
 
 
41
    def test_add_str_deprecated(self):
 
42
        os.mkdir('a')
 
43
        store = self.get_store('a')
 
44
        self.callDeprecated(['Passing a string to Store.add'
 
45
                             ' was deprecated in version 0.11.'],
 
46
                            store.add, 'foo', '1')
 
47
        self.assertEqual('foo', store.get('1').read())
 
48
 
41
49
    def fill_store(self, store):
42
50
        store.add(StringIO('hello'), 'a')
43
51
        store.add(StringIO('other'), 'b')
48
56
        """Test copying"""
49
57
        os.mkdir('a')
50
58
        store_a = self.get_store('a')
51
 
        store_a.add('foo', '1')
 
59
        store_a.add(StringIO('foo'), '1')
52
60
        os.mkdir('b')
53
61
        store_b = self.get_store('b')
54
62
        store_b.copy_all_ids(store_a)
81
89
class TestCompressedTextStore(TestCaseInTempDir, TestStores):
82
90
 
83
91
    def get_store(self, path=u'.'):
84
 
        t = LocalTransport(path)
 
92
        t = transport.get_transport(path)
85
93
        return TextStore(t, compressed=True)
86
94
 
87
95
    def test_total_size(self):
138
146
class TestTextStore(TestCaseInTempDir, TestStores):
139
147
 
140
148
    def get_store(self, path=u'.'):
141
 
        t = LocalTransport(path)
 
149
        t = transport.get_transport(path)
142
150
        return TextStore(t, compressed=False)
143
151
 
144
152
    def test_total_size(self):
156
164
class TestMixedTextStore(TestCaseInTempDir, TestStores):
157
165
 
158
166
    def get_store(self, path=u'.', compressed=True):
159
 
        t = LocalTransport(path)
 
167
        t = transport.get_transport(path)
160
168
        return TextStore(t, compressed=compressed)
161
169
 
162
170
    def test_get_mixed(self):