~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-26 20:32:49 UTC
  • mto: (2581.1.1 cleanup-runbzr)
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: v.ladeuil+lp@free.fr-20070626203249-sqm4afiai5dxofum
Deprecate the varargs syntax and fix the tests.

* bzrlib/tests/__init__.py:
(TestCase.run_bzr): Activate the deprecation warning.
(TestCase.run_bzr_error): Add error_regexes to kwargs or run_bzr
get confused.

* bzrlib/tests/blackbox/test_selftest.py:
(TestRunBzr.test_args): Activate.

* bzrlib/tests/blackbox/test_inventory.py:
(TestInventory.assertInventoryEqual): Build the command from args
if not None.

* bzrlib/tests/blackbox/test_ls.py:
(TestLS.ls_equals): Build the command from args if not None.

* bzrlib/tests/blackbox/test_remove_tree.py:
(TestRemoveTree.test_remove_tree_lightweight_checkout_explicit):
Nice catch, we were calling run_bzr instead of run_bzr_error. This
went unnoticed for some time...

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)