/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/plugins/netrc_credential_store/tests/test_netrc.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from cStringIO import StringIO
18
 
 
19
 
from bzrlib import (
 
17
from .... import (
20
18
    config,
21
19
    errors,
22
20
    osutils,
23
21
    tests,
24
22
    )
 
23
from ....sixish import (
 
24
    BytesIO,
 
25
    )
25
26
 
26
 
from bzrlib.plugins import netrc_credential_store
 
27
from ... import netrc_credential_store
27
28
 
28
29
 
29
30
class TestNetrcCSNoNetrc(tests.TestCaseInTempDir):
48
49
            f.write(netrc_content)
49
50
        # python's netrc will complain about access permissions starting with
50
51
        # 2.7.5-8 so we restrict the access unconditionally
51
 
        osutils.chmod_if_possible(netrc_path, 0600)
 
52
        osutils.chmod_if_possible(netrc_path, 0o600)
52
53
 
53
54
    def _get_netrc_cs(self):
54
55
        return  config.credential_store_registry.get_credential_store('netrc')
81
82
user = joe
82
83
password_encoding = netrc
83
84
"""
84
 
        conf = config.AuthenticationConfig(_file=StringIO(ac_content))
 
85
        conf = config.AuthenticationConfig(_file=BytesIO(ac_content))
85
86
        credentials = conf.get_credentials('scheme', 'host', user='joe')
86
87
        self.assertIsNot(None, credentials)
87
88
        self.assertEqual('secret', credentials.get('password', None))