Rev 6362: Simplify by using an in-memory config store and stack. in file:///home/vila/src/bzr/reviews/commit-uses-config-stacks/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Dec 14 10:04:13 UTC 2011


At file:///home/vila/src/bzr/reviews/commit-uses-config-stacks/

------------------------------------------------------------
revno: 6362
revision-id: v.ladeuil+lp at free.fr-20111214100413-xptcryznfmrlrxq2
parent: v.ladeuil+lp at free.fr-20111214095723-nzswy7z45ns8nv6g
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: commit-uses-config-stacks
timestamp: Wed 2011-12-14 11:04:13 +0100
message:
  Simplify by using an in-memory config store and stack.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_gpg.py'
--- a/bzrlib/tests/test_gpg.py	2011-12-14 09:57:23 +0000
+++ b/bzrlib/tests/test_gpg.py	2011-12-14 10:04:13 +0000
@@ -34,29 +34,21 @@
     )
 
 
-class FakeConfig(config.GlobalStack):
-
-    def get(self, name):
-        if name == "gpg_signing_key":
-            return "amy at example.com"
-        elif name == "gpg_signing_command":
-            return "false"
-        elif name == "acceptable_keys":
-            return None
-        else:
-            return None
-
-
-class TestCommandLine(tests.TestCaseWithTransport):
+class FakeConfig(config.Stack):
+
+    def __init__(self):
+        store = config.IniFileStore()
+        store._load_from_string('''
+gpg_signing_key=amy at example.com
+gpg_signing_command=false''')
+        super(FakeConfig, self).__init__([store.get_sections])
+
+
+class TestCommandLine(tests.TestCase):
 
     def setUp(self):
         super(TestCommandLine, self).setUp()
-        store = config.GlobalStore()
-        store._load_from_string('''[DEFAULT]
-gpg_signing_key=amy at example.com
-gpg_signing_command=false''')
-        store.save()
-        self.my_gpg = gpg.GPGStrategy(config.GlobalStack())
+        self.my_gpg = gpg.GPGStrategy(FakeConfig())
 
     def test_signing_command_line(self):
         self.assertEqual(['false',  '--clearsign', '-u', 'amy at example.com'],



More information about the bazaar-commits mailing list