359
359
def test_empty_dir(self):
360
360
"""Initializing an empty dir should succeed and do it."""
361
361
backing = self.get_transport()
362
name = self.make_bzrdir('reference')._format.network_name()
362
363
request = smart.bzrdir.SmartServerRequestBzrDirInitializeEx(backing)
363
self.assertEqual(SmartServerResponse(()), request.execute('', 'True'))
364
self.assertEqual(SmartServerResponse(('', '', '', '', '', '', name,
366
request.execute(name, '', 'True', 'False', 'False', '', '', '', '',
364
368
made_dir = bzrdir.BzrDir.open_from_transport(backing)
365
369
# no branch, tree or repository is expected with the current
366
370
# default formart.
371
375
def test_missing_dir(self):
372
376
"""Initializing a missing directory should fail like the bzrdir api."""
373
377
backing = self.get_transport()
378
name = self.make_bzrdir('reference')._format.network_name()
374
379
request = smart.bzrdir.SmartServerRequestBzrDirInitializeEx(backing)
375
self.assertRaises(errors.NoSuchFile, request.execute, 'subdir/dir', 'False')
380
self.assertRaises(errors.NoSuchFile, request.execute, name,
381
'subdir/dir', 'False', 'False', 'False', '', '', '', '', 'False')
377
383
def test_initialized_dir(self):
378
384
"""Initializing an extant dirctory should fail like the bzrdir api."""
379
385
backing = self.get_transport()
386
name = self.make_bzrdir('reference')._format.network_name()
380
387
request = smart.bzrdir.SmartServerRequestBzrDirInitializeEx(backing)
381
388
self.make_bzrdir('subdir')
382
self.assertRaises(errors.FileExists, request.execute, 'subdir', 'False')
389
self.assertRaises(errors.FileExists, request.execute, name, 'subdir',
390
'False', 'False', 'False', '', '', '', '', 'False')
385
393
class TestSmartServerRequestOpenBranch(TestCaseWithChrootedTransport):