244
244
self.assertEqual(tests[0].repository_format_to, formats[0][2])
245
245
self.assertEqual(tests[0].transport_server, server1)
246
246
self.assertEqual(tests[0].transport_readonly_server, server2)
247
self.assertEqual(tests[0].interrepo_class, formats[1][0])
247
self.assertEqual(tests[1].interrepo_class, formats[1][0])
248
248
self.assertEqual(tests[1].repository_format, formats[1][1])
249
249
self.assertEqual(tests[1].repository_format_to, formats[1][2])
250
250
self.assertEqual(tests[1].transport_server, server1)
251
251
self.assertEqual(tests[1].transport_readonly_server, server2)
254
class TestInterVersionedFileProviderAdapter(TestCase):
255
"""A group of tests that test the InterVersionedFile test adapter."""
257
def test_adapted_tests(self):
258
# check that constructor parameters are passed through to the adapted
260
from bzrlib.versionedfile import InterVersionedFileTestProviderAdapter
261
input_test = TestInterRepositoryProviderAdapter(
262
"test_adapted_tests")
265
formats = [(str, "C1", "C2"), (int, "D1", "D2")]
266
adapter = InterVersionedFileTestProviderAdapter(server1, server2, formats)
267
suite = adapter.adapt(input_test)
268
tests = list(iter(suite))
269
self.assertEqual(2, len(tests))
270
self.assertEqual(tests[0].interversionedfile_class, formats[0][0])
271
self.assertEqual(tests[0].versionedfile_factory, formats[0][1])
272
self.assertEqual(tests[0].versionedfile_factory_to, formats[0][2])
273
self.assertEqual(tests[0].transport_server, server1)
274
self.assertEqual(tests[0].transport_readonly_server, server2)
275
self.assertEqual(tests[1].interversionedfile_class, formats[1][0])
276
self.assertEqual(tests[1].versionedfile_factory, formats[1][1])
277
self.assertEqual(tests[1].versionedfile_factory_to, formats[1][2])
278
self.assertEqual(tests[1].transport_server, server1)
279
self.assertEqual(tests[1].transport_readonly_server, server2)
282
class TestRevisionStoreProviderAdapter(TestCase):
283
"""A group of tests that test the RevisionStore test adapter."""
285
def test_adapted_tests(self):
286
# check that constructor parameters are passed through to the adapted
288
from bzrlib.store.revision import RevisionStoreTestProviderAdapter
289
input_test = TestRevisionStoreProviderAdapter(
290
"test_adapted_tests")
291
# revision stores need a store factory - i.e. RevisionKnit
292
#, a readonly and rw transport
296
store_factories = ["c", "d"]
297
adapter = RevisionStoreTestProviderAdapter(server1, server2, store_factories)
298
suite = adapter.adapt(input_test)
299
tests = list(iter(suite))
300
self.assertEqual(2, len(tests))
301
self.assertEqual(tests[0].store_factory, store_factories[0][0])
302
self.assertEqual(tests[0].transport_server, server1)
303
self.assertEqual(tests[0].transport_readonly_server, server2)
304
self.assertEqual(tests[1].store_factory, store_factories[1][0])
305
self.assertEqual(tests[1].transport_server, server1)
306
self.assertEqual(tests[1].transport_readonly_server, server2)
254
309
class TestWorkingTreeProviderAdapter(TestCase):
255
310
"""A group of tests that test the workingtree implementation test adapter."""
312
367
self.failUnless(isinstance(t2, HttpTransportBase))
313
368
self.assertEqual(t2.base[:-1], t.abspath('foo/bar'))
370
def test_is_directory(self):
371
"""Test assertIsDirectory assertion"""
372
t = self.get_transport()
373
self.build_tree(['a_dir/', 'a_file'], transport=t)
374
self.assertIsDirectory('a_dir', t)
375
self.assertRaises(AssertionError, self.assertIsDirectory, 'a_file', t)
376
self.assertRaises(AssertionError, self.assertIsDirectory, 'not_here', t)
316
378
class TestChrootedTest(ChrootedTestCase):