~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-02-18 02:33:47 UTC
  • mfrom: (1534.1.24 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060218023347-0952c65f668bfd68
Merge Robert Collins integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
            "test_adapted_tests")
242
242
        server1 = "a"
243
243
        server2 = "b"
 
244
        formats = [("c", "C"), ("d", "D")]
 
245
        adapter = BranchTestProviderAdapter(server1, server2, formats)
 
246
        suite = adapter.adapt(input_test)
 
247
        tests = list(iter(suite))
 
248
        self.assertEqual(2, len(tests))
 
249
        self.assertEqual(tests[0].branch_format, formats[0][0])
 
250
        self.assertEqual(tests[0].bzrdir_format, formats[0][1])
 
251
        self.assertEqual(tests[0].transport_server, server1)
 
252
        self.assertEqual(tests[0].transport_readonly_server, server2)
 
253
        self.assertEqual(tests[1].branch_format, formats[1][0])
 
254
        self.assertEqual(tests[1].bzrdir_format, formats[1][1])
 
255
        self.assertEqual(tests[1].transport_server, server1)
 
256
        self.assertEqual(tests[1].transport_readonly_server, server2)
 
257
 
 
258
 
 
259
class TestBzrDirProviderAdapter(TestCase):
 
260
    """A group of tests that test the bzr dir implementation test adapter."""
 
261
 
 
262
    def test_adapted_tests(self):
 
263
        # check that constructor parameters are passed through to the adapted
 
264
        # test.
 
265
        from bzrlib.bzrdir import BzrDirTestProviderAdapter
 
266
        input_test = TestBzrDirProviderAdapter(
 
267
            "test_adapted_tests")
 
268
        server1 = "a"
 
269
        server2 = "b"
244
270
        formats = ["c", "d"]
245
 
        adapter = BranchTestProviderAdapter(server1, server2, formats)
246
 
        suite = adapter.adapt(input_test)
247
 
        tests = list(iter(suite))
248
 
        self.assertEqual(2, len(tests))
249
 
        self.assertEqual(tests[0].branch_format, formats[0])
250
 
        self.assertEqual(tests[0].transport_server, server1)
251
 
        self.assertEqual(tests[0].transport_readonly_server, server2)
252
 
        self.assertEqual(tests[1].branch_format, formats[1])
 
271
        adapter = BzrDirTestProviderAdapter(server1, server2, formats)
 
272
        suite = adapter.adapt(input_test)
 
273
        tests = list(iter(suite))
 
274
        self.assertEqual(2, len(tests))
 
275
        self.assertEqual(tests[0].bzrdir_format, formats[0])
 
276
        self.assertEqual(tests[0].transport_server, server1)
 
277
        self.assertEqual(tests[0].transport_readonly_server, server2)
 
278
        self.assertEqual(tests[1].bzrdir_format, formats[1])
 
279
        self.assertEqual(tests[1].transport_server, server1)
 
280
        self.assertEqual(tests[1].transport_readonly_server, server2)
 
281
 
 
282
 
 
283
class TestRepositoryProviderAdapter(TestCase):
 
284
    """A group of tests that test the repository implementation test adapter."""
 
285
 
 
286
    def test_adapted_tests(self):
 
287
        # check that constructor parameters are passed through to the adapted
 
288
        # test.
 
289
        from bzrlib.repository import RepositoryTestProviderAdapter
 
290
        input_test = TestRepositoryProviderAdapter(
 
291
            "test_adapted_tests")
 
292
        server1 = "a"
 
293
        server2 = "b"
 
294
        formats = [("c", "C"), ("d", "D")]
 
295
        adapter = RepositoryTestProviderAdapter(server1, server2, formats)
 
296
        suite = adapter.adapt(input_test)
 
297
        tests = list(iter(suite))
 
298
        self.assertEqual(2, len(tests))
 
299
        self.assertEqual(tests[0].bzrdir_format, formats[0][1])
 
300
        self.assertEqual(tests[0].repository_format, formats[0][0])
 
301
        self.assertEqual(tests[0].transport_server, server1)
 
302
        self.assertEqual(tests[0].transport_readonly_server, server2)
 
303
        self.assertEqual(tests[1].bzrdir_format, formats[1][1])
 
304
        self.assertEqual(tests[1].repository_format, formats[1][0])
 
305
        self.assertEqual(tests[1].transport_server, server1)
 
306
        self.assertEqual(tests[1].transport_readonly_server, server2)
 
307
 
 
308
 
 
309
class TestWorkingTreeProviderAdapter(TestCase):
 
310
    """A group of tests that test the workingtree implementation test adapter."""
 
311
 
 
312
    def test_adapted_tests(self):
 
313
        # check that constructor parameters are passed through to the adapted
 
314
        # test.
 
315
        from bzrlib.workingtree import WorkingTreeTestProviderAdapter
 
316
        input_test = TestWorkingTreeProviderAdapter(
 
317
            "test_adapted_tests")
 
318
        server1 = "a"
 
319
        server2 = "b"
 
320
        formats = [("c", "C"), ("d", "D")]
 
321
        adapter = WorkingTreeTestProviderAdapter(server1, server2, formats)
 
322
        suite = adapter.adapt(input_test)
 
323
        tests = list(iter(suite))
 
324
        self.assertEqual(2, len(tests))
 
325
        self.assertEqual(tests[0].workingtree_format, formats[0][0])
 
326
        self.assertEqual(tests[0].bzrdir_format, formats[0][1])
 
327
        self.assertEqual(tests[0].transport_server, server1)
 
328
        self.assertEqual(tests[0].transport_readonly_server, server2)
 
329
        self.assertEqual(tests[1].workingtree_format, formats[1][0])
 
330
        self.assertEqual(tests[1].bzrdir_format, formats[1][1])
253
331
        self.assertEqual(tests[1].transport_server, server1)
254
332
        self.assertEqual(tests[1].transport_readonly_server, server2)
255
333