Rev 5801: Add a test for remote bzr dir. in file:///home/vila/src/bzr/experimental/config/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 13 17:35:08 UTC 2011


At file:///home/vila/src/bzr/experimental/config/

------------------------------------------------------------
revno: 5801
revision-id: v.ladeuil+lp at free.fr-20110613173508-m1i6ocxtum0dqcbg
parent: v.ladeuil+lp at free.fr-20110613172427-j62b8nvgauq90tdy
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-hooks
timestamp: Mon 2011-06-13 19:35:08 +0200
message:
  Add a test for remote bzr dir.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-06-13 17:24:27 +0000
+++ b/bzrlib/tests/test_config.py	2011-06-13 17:35:08 +0000
@@ -2033,19 +2033,26 @@
         self.transport_server = test_server.SmartTCPServer_for_testing
         create_configs_with_file_option(self)
 
-    def test_get_hook(self):
+    def assertGetHook(self, conf, name, value):
+        calls = []
+        def hook(*args):
+            calls.append(args)
+        config.ConfigHooks.install_named_hook('old_get', hook, None)
+        self.assertLength(0, calls)
+        actual_value = conf.get_option(name)
+        self.assertEquals(value, actual_value)
+        self.assertLength(1, calls)
+        self.assertEquals((conf, name, value), calls[0])
+
+    def test_get_hook_remote_branch(self):
         remote_branch = branch.Branch.open(self.get_url('tree'))
-        conf = remote_branch._get_config()
-        calls = []
-        def hook(*args):
-            calls.append(args)
-        config.ConfigHooks.install_named_hook('old_get', hook, None)
-        self.assertLength(0, calls)
-        actual_value = conf.get_option('file')
-        self.assertEquals('branch', actual_value)
-        self.assertLength(1, calls)
-        self.assertEquals((conf, 'file', 'branch'), calls[0])
+        self.assertGetHook(remote_branch._get_config(), 'file', 'branch')
 
+    def test_get_hook_remote_bzrdir(self):
+        remote_bzrdir = bzrdir.BzrDir.open(self.get_url('tree'))
+        conf = remote_bzrdir._get_config()
+        conf.set_option('remotedir', 'file')
+        self.assertGetHook(conf, 'file', 'remotedir')
 
 
 class TestOption(tests.TestCase):



More information about the bazaar-commits mailing list