/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_store.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 08:58:15 UTC
  • mfrom: (5609.48.2 2.3)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706085815-6leauod52jq2u43d
MergingĀ inĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2007 Canonical Ltd
 
1
# Copyright (C) 2005-2009, 2011 Canonical Ltd
2
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
21
21
import gzip
22
22
 
23
23
import bzrlib.errors as errors
24
 
from bzrlib.errors import BzrError, UnlistableStore, NoSuchFile
25
 
from bzrlib.transport.local import LocalTransport
 
24
from bzrlib.errors import BzrError
26
25
from bzrlib.store.text import TextStore
27
26
from bzrlib.tests import TestCase, TestCaseInTempDir, TestCaseWithTransport
28
27
import bzrlib.store as store
116
115
 
117
116
    def test_missing_is_absent(self):
118
117
        store = self.get_store()
119
 
        self.failIf('aa' in store)
 
118
        self.assertFalse('aa' in store)
120
119
 
121
120
    def test_adding_fails_when_present(self):
122
121
        my_store = self.get_store()
165
164
        s = self.get_store(u'.', compressed=False)
166
165
        cs.add(StringIO('hello there'), 'a')
167
166
 
168
 
        self.failUnlessExists('a.gz')
169
 
        self.failIf(os.path.lexists('a'))
 
167
        self.assertPathExists('a.gz')
 
168
        self.assertFalse(os.path.lexists('a'))
170
169
 
171
170
        self.assertEquals(gzip.GzipFile('a.gz').read(), 'hello there')
172
171
 
178
177
        self.assertRaises(BzrError, s.add, StringIO('goodbye'), 'a')
179
178
 
180
179
        s.add(StringIO('goodbye'), 'b')
181
 
        self.failUnlessExists('b')
182
 
        self.failIf(os.path.lexists('b.gz'))
 
180
        self.assertPathExists('b')
 
181
        self.assertFalse(os.path.lexists('b.gz'))
183
182
        self.assertEquals(open('b').read(), 'goodbye')
184
183
 
185
184
        self.assertEquals(cs.has_id('b'), True)
230
229
class TestMockTransport(TestCase):
231
230
 
232
231
    def test_isinstance(self):
233
 
        self.failUnless(isinstance(MockTransport(), transport.Transport))
 
232
        self.assertIsInstance(MockTransport(), transport.Transport)
234
233
 
235
234
    def test_has(self):
236
235
        self.assertEqual(False, MockTransport().has('foo'))