~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_whoami.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        self.assertTrue(len(out) > 0)
33
33
        self.assertEquals(1, out.count('@'))
34
34
 
35
 
        out = self.run_bzr("whoami", "--email")[0]
 
35
        out = self.run_bzr("whoami --email")[0]
36
36
        self.assertTrue(len(out) > 0)
37
37
        self.assertEquals(1, out.count('@'))
38
38
        
51
51
        try:
52
52
            whoami = self.run_bzr("whoami")[0]
53
53
            self.assertEquals('Branch Identity <branch@identi.ty>\n', whoami)
54
 
            whoami_email = self.run_bzr("whoami", "--email")[0]
 
54
            whoami_email = self.run_bzr("whoami --email")[0]
55
55
            self.assertEquals('branch@identi.ty\n', whoami_email)
56
56
 
57
57
            # Verify that the environment variable overrides the value 
59
59
            os.environ['BZR_EMAIL'] = 'Different ID <other@environ.ment>'
60
60
            whoami = self.run_bzr("whoami")[0]
61
61
            self.assertEquals('Different ID <other@environ.ment>\n', whoami)
62
 
            whoami_email = self.run_bzr("whoami", "--email")[0]
 
62
            whoami_email = self.run_bzr("whoami --email")[0]
63
63
            self.assertEquals('other@environ.ment\n', whoami_email)
64
64
            del os.environ['BZR_EMAIL']
65
65
            os.environ['BZREMAIL'] = 'Yet Another ID <yetother@environ.ment>'
76
76
    def test_whoami_utf8(self):
77
77
        """verify that an identity can be in utf-8."""
78
78
        wt = self.make_branch_and_tree('.')
79
 
        self.run_bzr('whoami', u'Branch Identity \u20ac <branch@identi.ty>',
 
79
        self.run_bzr(['whoami', u'Branch Identity \u20ac <branch@identi.ty>'],
80
80
                     encoding='utf-8')
81
81
        bzr_email = os.environ.get('BZR_EMAIL')
82
82
        if bzr_email is not None:
85
85
            whoami = self.run_bzr("whoami", encoding='utf-8')[0]
86
86
            self.assertEquals('Branch Identity \xe2\x82\xac ' +
87
87
                              '<branch@identi.ty>\n', whoami)
88
 
            whoami_email = self.run_bzr("whoami", "--email",
 
88
            whoami_email = self.run_bzr("whoami --email",
89
89
                                        encoding='utf-8')[0]
90
90
            self.assertEquals('branch@identi.ty\n', whoami_email)
91
91
        finally:
107
107
        try:
108
108
            whoami = self.run_bzr("whoami", encoding='ascii')[0]
109
109
            self.assertEquals('Branch Identity ? <branch@identi.ty>\n', whoami)
110
 
            whoami_email = self.run_bzr("whoami", "--email",
 
110
            whoami_email = self.run_bzr("whoami --email",
111
111
                                        encoding='ascii')[0]
112
112
            self.assertEquals('branch@identi.ty\n', whoami_email)
113
113
        finally:
117
117
    def test_warning(self):
118
118
        """verify that a warning is displayed if no email is given."""
119
119
        self.make_branch_and_tree('.')
120
 
        display = self.run_bzr('whoami', 'Branch Identity')[1]
 
120
        display = self.run_bzr(['whoami', 'Branch Identity'])[1]
121
121
        self.assertEquals('"Branch Identity" does not seem to contain an '
122
122
                          'email address.  This is allowed, but not '
123
123
                          'recommended.\n', display)