~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-05 16:19:30 UTC
  • mto: This revision was merged to the branch mainline in revision 6437.
  • Revision ID: v.ladeuil+lp@free.fr-20120105161930-bh6bwqnt9tvv902f
Tweak news entry to conflict on merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2097
2097
 
2098
2098
class TestGetuserUnicode(tests.TestCase):
2099
2099
 
2100
 
    def test_is_unicode(self):
2101
 
        user = osutils.getuser_unicode()
2102
 
        self.assertIsInstance(user, unicode)
2103
 
 
2104
 
    def envvar_to_override(self):
2105
 
        if sys.platform == "win32":
2106
 
            # Disable use of platform calls on windows so envvar is used
2107
 
            self.overrideAttr(win32utils, 'has_ctypes', False)
2108
 
            return 'USERNAME' # only variable used on windows
2109
 
        return 'LOGNAME' # first variable checked by getpass.getuser()
2110
 
 
2111
2100
    def test_ascii_user(self):
2112
 
        self.overrideEnv(self.envvar_to_override(), 'jrandom')
 
2101
        self.overrideEnv('LOGNAME', 'jrandom')
2113
2102
        self.assertEqual(u'jrandom', osutils.getuser_unicode())
2114
2103
 
2115
2104
    def test_unicode_user(self):
2121
2110
                % (osutils.get_user_encoding(),))
2122
2111
        uni_username = u'jrandom' + uni_val
2123
2112
        encoded_username = uni_username.encode(ue)
2124
 
        self.overrideEnv(self.envvar_to_override(), encoded_username)
 
2113
        self.overrideEnv('LOGNAME', encoded_username)
2125
2114
        self.assertEqual(uni_username, osutils.getuser_unicode())
 
2115
        self.overrideEnv('LOGNAME', u'jrandom\xb6'.encode(ue))
 
2116
        self.assertEqual(u'jrandom\xb6', osutils.getuser_unicode())
2126
2117
 
2127
2118
 
2128
2119
class TestBackupNames(tests.TestCase):