~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Robert Collins
  • Date: 2006-03-03 01:47:22 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303014722-e890b9bf8628aebf
Add a revision store test adapter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
            "test_adapted_tests")
318
318
        server1 = "a"
319
319
        server2 = "b"
320
 
        formats = [(str, "C1", "C2"), (str, "D1", "D2")]
 
320
        formats = [(str, "C1", "C2"), (int, "D1", "D2")]
321
321
        adapter = InterRepositoryTestProviderAdapter(server1, server2, formats)
322
322
        suite = adapter.adapt(input_test)
323
323
        tests = list(iter(suite))
327
327
        self.assertEqual(tests[0].repository_format_to, formats[0][2])
328
328
        self.assertEqual(tests[0].transport_server, server1)
329
329
        self.assertEqual(tests[0].transport_readonly_server, server2)
330
 
        self.assertEqual(tests[0].interrepo_class, formats[1][0])
 
330
        self.assertEqual(tests[1].interrepo_class, formats[1][0])
331
331
        self.assertEqual(tests[1].repository_format, formats[1][1])
332
332
        self.assertEqual(tests[1].repository_format_to, formats[1][2])
333
333
        self.assertEqual(tests[1].transport_server, server1)
345
345
            "test_adapted_tests")
346
346
        server1 = "a"
347
347
        server2 = "b"
348
 
        formats = [(str, "C1", "C2"), (str, "D1", "D2")]
 
348
        formats = [(str, "C1", "C2"), (int, "D1", "D2")]
349
349
        adapter = InterVersionedFileTestProviderAdapter(server1, server2, formats)
350
350
        suite = adapter.adapt(input_test)
351
351
        tests = list(iter(suite))
355
355
        self.assertEqual(tests[0].versionedfile_factory_to, formats[0][2])
356
356
        self.assertEqual(tests[0].transport_server, server1)
357
357
        self.assertEqual(tests[0].transport_readonly_server, server2)
358
 
        self.assertEqual(tests[0].interversionedfile_class, formats[1][0])
 
358
        self.assertEqual(tests[1].interversionedfile_class, formats[1][0])
359
359
        self.assertEqual(tests[1].versionedfile_factory, formats[1][1])
360
360
        self.assertEqual(tests[1].versionedfile_factory_to, formats[1][2])
361
361
        self.assertEqual(tests[1].transport_server, server1)
362
362
        self.assertEqual(tests[1].transport_readonly_server, server2)
363
363
 
364
364
 
 
365
class TestRevisionStoreProviderAdapter(TestCase):
 
366
    """A group of tests that test the RevisionStore test adapter."""
 
367
 
 
368
    def test_adapted_tests(self):
 
369
        # check that constructor parameters are passed through to the adapted
 
370
        # test.
 
371
        from bzrlib.store.revision import RevisionStoreTestProviderAdapter
 
372
        input_test = TestRevisionStoreProviderAdapter(
 
373
            "test_adapted_tests")
 
374
        # revision stores need a store factory - i.e. RevisionKnit
 
375
        #, a readonly and rw transport 
 
376
        # transport servers:
 
377
        server1 = "a"
 
378
        server2 = "b"
 
379
        store_factories = ["c", "d"]
 
380
        adapter = RevisionStoreTestProviderAdapter(server1, server2, store_factories)
 
381
        suite = adapter.adapt(input_test)
 
382
        tests = list(iter(suite))
 
383
        self.assertEqual(2, len(tests))
 
384
        self.assertEqual(tests[0].store_factory, store_factories[0][0])
 
385
        self.assertEqual(tests[0].transport_server, server1)
 
386
        self.assertEqual(tests[0].transport_readonly_server, server2)
 
387
        self.assertEqual(tests[1].store_factory, store_factories[1][0])
 
388
        self.assertEqual(tests[1].transport_server, server1)
 
389
        self.assertEqual(tests[1].transport_readonly_server, server2)
 
390
 
 
391
 
365
392
class TestWorkingTreeProviderAdapter(TestCase):
366
393
    """A group of tests that test the workingtree implementation test adapter."""
367
394