~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testconfig.py

  • Committer: Robert Collins
  • Date: 2005-10-14 04:54:03 UTC
  • mto: This revision was merged to the branch mainline in revision 1456.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051014045403-321deeebf084406f
allow global overriding of signature policy to force checking, or (pointless but allowed) to set auto checking

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                      "gpg_signing_command=gnome-gpg\n")
35
35
 
36
36
 
 
37
sample_always_signatures = ("[DEFAULT]\n"
 
38
                            "signatures=require\n")
 
39
 
 
40
 
37
41
sample_ignore_signatures = ("[DEFAULT]\n"
38
42
                            "signatures=ignore\n")
39
43
 
40
44
 
 
45
sample_maybe_signatures = ("[DEFAULT]\n"
 
46
                            "signatures=check-available\n")
 
47
 
 
48
 
41
49
sample_branches_text = ("[http://www.example.com]\n"
42
50
                        "# Top level policy\n"
43
51
                        "email=Robert Collins <robertc@example.org>\n"
249
257
        my_config._parser = my_config._get_config_parser(file=config_file)
250
258
        self.assertEqual("vim", my_config.get_editor())
251
259
 
 
260
    def test_signatures_always(self):
 
261
        config_file = StringIO(sample_always_signatures)
 
262
        my_config = config.GlobalConfig()
 
263
        my_config._parser = my_config._get_config_parser(file=config_file)
 
264
        self.assertEqual(config.CHECK_ALWAYS,
 
265
                         my_config.signature_checking())
 
266
 
 
267
    def test_signatures_if_possible(self):
 
268
        config_file = StringIO(sample_maybe_signatures)
 
269
        my_config = config.GlobalConfig()
 
270
        my_config._parser = my_config._get_config_parser(file=config_file)
 
271
        self.assertEqual(config.CHECK_IF_POSSIBLE,
 
272
                         my_config.signature_checking())
 
273
 
252
274
    def test_signatures_ignore(self):
253
275
        config_file = StringIO(sample_ignore_signatures)
254
276
        my_config = config.GlobalConfig()