~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_https_ca_bundle.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
import os
20
20
import sys
21
21
 
22
 
import bzrlib
23
 
from bzrlib import osutils
24
22
from bzrlib.tests import (
25
23
    TestCaseInTempDir,
26
24
    TestSkipped,
31
29
class TestGetCAPath(TestCaseInTempDir):
32
30
 
33
31
    def setUp(self):
34
 
        TestCaseInTempDir.setUp(self)
35
 
        new_env = {
36
 
            'CURL_CA_BUNDLE': None,
37
 
            'PATH': None,
38
 
            }
39
 
        self._old_env = {}
40
 
        self.addCleanup(self._restore)
41
 
        for name, value in new_env.iteritems():
42
 
            self._old_env[name] = osutils.set_or_unset_env(name, None)
43
 
 
44
 
    def _restore(self):
45
 
        for name, value in self._old_env.iteritems():
46
 
            osutils.set_or_unset_env(name, value)
 
32
        super(TestGetCAPath, self).setUp()
 
33
        self.overrideEnv('CURL_CA_BUNDLE', None)
 
34
        self.overrideEnv('PATH', None)
47
35
 
48
36
    def _make_file(self, in_dir='.'):
49
37
        fname = os.path.join(in_dir, 'curl-ca-bundle.crt')
55
43
        self.assertEqual('', ca_bundle.get_ca_path(use_cache=False))
56
44
 
57
45
    def test_env_var(self):
58
 
        osutils.set_or_unset_env('CURL_CA_BUNDLE', 'foo.bar')
 
46
        self.overrideEnv('CURL_CA_BUNDLE', 'foo.bar')
59
47
        self._make_file()
60
48
        self.assertEqual('foo.bar', ca_bundle.get_ca_path(use_cache=False))
61
49
 
65
53
        os.mkdir('foo')
66
54
        in_dir = os.path.join(os.getcwd(), 'foo')
67
55
        self._make_file(in_dir=in_dir)
68
 
        osutils.set_or_unset_env('PATH', in_dir)
 
56
        self.overrideEnv('PATH', in_dir)
69
57
        shouldbe = os.path.join(in_dir, 'curl-ca-bundle.crt')
70
58
        self.assertEqual(shouldbe, ca_bundle.get_ca_path(use_cache=False))