~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009-2012 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
30
30
 
31
31
    def assertWhoAmI(self, expected, *cmd_args, **kwargs):
32
32
        out, err = self.run_bzr(('whoami',) + cmd_args, **kwargs)
33
 
        self.assertEquals('', err)
 
33
        self.assertEqual('', err)
34
34
        lines = out.splitlines()
35
35
        self.assertLength(1, lines)
36
 
        self.assertEquals(expected, lines[0].rstrip())
 
36
        self.assertEqual(expected, lines[0].rstrip())
37
37
 
38
38
    def test_whoami_no_args_no_conf(self):
39
39
        # this should always identify something, if only "john@localhost"
40
40
        out = self.run_bzr("whoami")[0]
41
41
        self.assertTrue(len(out) > 0)
42
 
        self.assertEquals(1, out.count('@'))
 
42
        self.assertEqual(1, out.count('@'))
43
43
 
44
44
    def test_whoami_email_no_args(self):
45
45
        out = self.run_bzr("whoami --email")[0]
46
46
        self.assertTrue(len(out) > 0)
47
 
        self.assertEquals(1, out.count('@'))
 
47
        self.assertEqual(1, out.count('@'))
48
48
 
49
49
    def test_whoami_email_arg(self):
50
50
        # whoami --email is mutually exclusive with any arguments
51
51
        out = self.run_bzr("whoami --email 'foo <foo@example.com>'", 3)[0]
52
 
        self.assertEquals("", out)
 
52
        self.assertEqual("", out)
53
53
 
54
54
    def set_branch_email(self, b, email):
55
55
        b.get_config_stack().set('email', email)
93
93
        """verify that a warning is displayed if no email is given."""
94
94
        self.make_branch_and_tree('.')
95
95
        display = self.run_bzr(['whoami', 'Branch Identity'])[1]
96
 
        self.assertEquals('"Branch Identity" does not seem to contain an '
 
96
        self.assertEqual('"Branch Identity" does not seem to contain an '
97
97
                          'email address.  This is allowed, but not '
98
98
                          'recommended.\n', display)
99
99
 
118
118
        # Refresh wt as 'whoami' modified it
119
119
        wt = wt.bzrdir.open_workingtree()
120
120
        c = wt.branch.get_config_stack()
121
 
        self.assertEquals('Changed Identity <changed@identi.ty>',
 
121
        self.assertEqual('Changed Identity <changed@identi.ty>',
122
122
                          c.get('email'))
123
123
 
124
124
    def test_whoami_remote_directory(self):
134
134
        # The identity has been set in the branch config (but not the global
135
135
        # config)
136
136
        c = branch.Branch.open(url).get_config_stack()
137
 
        self.assertEquals('Changed Identity <changed@identi.ty>',
 
137
        self.assertEqual('Changed Identity <changed@identi.ty>',
138
138
                          c.get('email'))
139
139
        # Ensuring that the value does not come from the bazaar.conf file
140
140
        # itself requires some isolation setup