58
58
class TestCommands(ExternalBase):
60
def test_whoami(self):
61
# this should always identify something, if only "john@localhost"
63
self.runbzr("whoami --email")
65
self.assertEquals(self.runbzr("whoami --email",
66
backtick=True).count('@'), 1)
68
def test_whoami_branch(self):
69
"""branch specific user identity works."""
71
b = bzrlib.branch.Branch.open('.')
72
b.control_files.put_utf8('email', 'Branch Identity <branch@identi.ty>')
73
bzr_email = os.environ.get('BZREMAIL')
74
if bzr_email is not None:
75
del os.environ['BZREMAIL']
76
whoami = self.runbzr("whoami",backtick=True)
77
whoami_email = self.runbzr("whoami --email",backtick=True)
78
self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>'))
79
self.assertTrue(whoami_email.startswith('branch@identi.ty'))
80
# Verify that the environment variable overrides the value
82
os.environ['BZREMAIL'] = 'Different ID <other@environ.ment>'
83
whoami = self.runbzr("whoami",backtick=True)
84
whoami_email = self.runbzr("whoami --email",backtick=True)
85
self.assertTrue(whoami.startswith('Different ID <other@environ.ment>'))
86
self.assertTrue(whoami_email.startswith('other@environ.ment'))
87
if bzr_email is not None:
88
os.environ['BZREMAIL'] = bzr_email
90
60
def test_nick_command(self):
91
61
"""bzr nick for viewing, setting nicknames"""