~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_matchers.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from testtools.matchers import *
20
20
 
 
21
from bzrlib.smart.client import CallHookParams
 
22
 
21
23
from bzrlib.tests import (
 
24
    CapturedCall,
22
25
    TestCase,
23
26
    TestCaseWithTransport,
24
27
    )
146
149
        self.assertEquals(
147
150
            "[u'', u'a'] != [u'', u'a', u'b/', u'b/c']",
148
151
            mismatch.describe())
 
152
 
 
153
 
 
154
class TestContainsNoVfsCalls(TestCase):
 
155
 
 
156
    def _make_call(self, method, args):
 
157
        return CapturedCall(CallHookParams(method, args, None, None, None), 0)
 
158
 
 
159
    def test__str__(self):
 
160
        self.assertEqual("ContainsNoVfsCalls()", str(ContainsNoVfsCalls()))
 
161
 
 
162
    def test_empty(self):
 
163
        self.assertIs(None, ContainsNoVfsCalls().match([]))
 
164
 
 
165
    def test_no_vfs_calls(self):
 
166
        calls = [self._make_call("Branch.get_config_file", [])]
 
167
        self.assertIs(None, ContainsNoVfsCalls().match(calls))
 
168
 
 
169
    def test_ignores_unknown(self):
 
170
        calls = [self._make_call("unknown", [])]
 
171
        self.assertIs(None, ContainsNoVfsCalls().match(calls))
 
172
 
 
173
    def test_match(self):
 
174
        calls = [self._make_call("append", ["file"]),
 
175
                 self._make_call("Branch.get_config_file", [])]
 
176
        mismatch = ContainsNoVfsCalls().match(calls)
 
177
        self.assertIsNot(None, mismatch)
 
178
        self.assertEquals([calls[0].call], mismatch.vfs_calls)
 
179
        self.assertEquals("no VFS calls expected, got: append('file')""",
 
180
                mismatch.describe())