323
323
self.assertEqual(tests[1].transport_readonly_server, server2)
326
class TestTreeProviderAdapter(TestCase):
327
"""Test the setup of tree_implementation tests."""
329
def test_adapted_tests(self):
330
# the tree implementation adapter is meant to setup one instance for
331
# each working tree format, and one additional instance that will
332
# use the default wt format, but create a revision tree for the tests.
333
# this means that the wt ones should have the workingtree_to_test_tree
334
# attribute set to 'return_parameter' and the revision one set to
335
# revision_tree_from_workingtree.
337
from bzrlib.tests.tree_implementations import (
338
TreeTestProviderAdapter,
340
revision_tree_from_workingtree
342
from bzrlib.workingtree import WorkingTreeFormat
343
input_test = TestTreeProviderAdapter(
344
"test_adapted_tests")
347
formats = [("c", "C"), ("d", "D")]
348
adapter = TreeTestProviderAdapter(server1, server2, formats)
349
suite = adapter.adapt(input_test)
350
tests = list(iter(suite))
351
self.assertEqual(3, len(tests))
352
default_format = WorkingTreeFormat.get_default_format()
353
self.assertEqual(tests[0].workingtree_format, formats[0][0])
354
self.assertEqual(tests[0].bzrdir_format, formats[0][1])
355
self.assertEqual(tests[0].transport_server, server1)
356
self.assertEqual(tests[0].transport_readonly_server, server2)
357
self.assertEqual(tests[0].workingtree_to_test_tree, return_parameter)
358
self.assertEqual(tests[1].workingtree_format, formats[1][0])
359
self.assertEqual(tests[1].bzrdir_format, formats[1][1])
360
self.assertEqual(tests[1].transport_server, server1)
361
self.assertEqual(tests[1].transport_readonly_server, server2)
362
self.assertEqual(tests[1].workingtree_to_test_tree, return_parameter)
363
self.assertEqual(tests[2].workingtree_format, default_format)
364
self.assertEqual(tests[2].bzrdir_format, default_format._matchingbzrdir)
365
self.assertEqual(tests[2].transport_server, server1)
366
self.assertEqual(tests[2].transport_readonly_server, server2)
367
self.assertEqual(tests[2].workingtree_to_test_tree,
368
revision_tree_from_workingtree)
326
371
class TestTestCaseWithTransport(TestCaseWithTransport):
327
372
"""Tests for the convenience functions TestCaseWithTransport introduces."""