~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Merge the 2.3 branch changes up to 2.4. The final changes are
too invasive to do in a stable series (IMO).

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    )
43
43
from bzrlib.tests import (
44
44
    features,
 
45
    TestSkipped,
45
46
    scenarios,
46
47
    )
47
48
from bzrlib.util.configobj import configobj
2469
2470
# test_user_prompted ?
2470
2471
class TestAuthenticationRing(tests.TestCaseWithTransport):
2471
2472
    pass
 
2473
 
 
2474
 
 
2475
class TestAutoUserId(tests.TestCase):
 
2476
    """Test inferring an automatic user name."""
 
2477
 
 
2478
    def test_auto_user_id(self):
 
2479
        """Automatic inference of user name.
 
2480
        
 
2481
        This is a bit hard to test in an isolated way, because it depends on
 
2482
        system functions that go direct to /etc or perhaps somewhere else.
 
2483
        But it's reasonable to say that on Unix, with an /etc/mailname, we ought
 
2484
        to be able to choose a user name with no configuration.
 
2485
        """
 
2486
        if sys.platform == 'win32':
 
2487
            raise TestSkipped("User name inference not implemented on win32")
 
2488
        realname, address = config._auto_user_id()
 
2489
        if os.path.exists('/etc/mailname'):
 
2490
            self.assertTrue(realname)
 
2491
            self.assertTrue(address)
 
2492
        else:
 
2493
            self.assertEquals((None, None), (realname, address))
 
2494