/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Black-box tests for brz whoami."""
19
19
 
20
 
import breezy
21
20
from breezy import (
22
21
    branch,
23
22
    config,
24
23
    errors,
25
24
    tests,
26
25
    )
27
 
from breezy.sixish import PY3
 
26
 
 
27
from ..test_bedding import override_whoami
28
28
 
29
29
 
30
30
class TestWhoami(tests.TestCaseWithTransport):
34
34
        self.assertEqual('', err)
35
35
        lines = out.splitlines()
36
36
        self.assertLength(1, lines)
37
 
        if PY3 and isinstance(expected, bytes):
 
37
        if isinstance(expected, bytes):
38
38
            expected = expected.decode(kwargs.get('encoding', 'ascii'))
39
39
        self.assertEqual(expected, lines[0].rstrip())
40
40
 
60
60
    def test_whoami_branch(self):
61
61
        """branch specific user identity works."""
62
62
        wt = self.make_branch_and_tree('.')
63
 
        b = breezy.branch.Branch.open('.')
 
63
        b = branch.Branch.open('.')
64
64
        self.set_branch_email(b, 'Branch Identity <branch@identi.ty>')
65
65
        self.assertWhoAmI('Branch Identity <branch@identi.ty>')
66
66
        self.assertWhoAmI('branch@identi.ty', '--email')
85
85
        encoding.
86
86
        """
87
87
        wt = self.make_branch_and_tree('.')
88
 
        b = breezy.branch.Branch.open('.')
 
88
        b = branch.Branch.open('.')
89
89
        self.set_branch_email(b, u'Branch Identity \u20ac <branch@identi.ty>')
90
90
        self.assertWhoAmI('Branch Identity ? <branch@identi.ty>',
91
91
                          encoding='ascii')
103
103
    def test_whoami_not_set(self):
104
104
        """Ensure whoami error if username is not set and not inferred.
105
105
        """
106
 
        self.overrideEnv('EMAIL', None)
107
 
        self.overrideEnv('BRZ_EMAIL', None)
108
 
        # Also, make sure that it's not inferred from mailname.
109
 
        self.overrideAttr(config, '_auto_user_id', lambda: (None, None))
 
106
        override_whoami(self)
110
107
        out, err = self.run_bzr(['whoami'], 3)
111
108
        self.assertContainsRe(err, 'Unable to determine your name')
112
109
 
141
138
                         c.get('email'))
142
139
        # Ensuring that the value does not come from the breezy.conf file
143
140
        # itself requires some isolation setup
144
 
        self.overrideEnv('BRZ_EMAIL', None)
145
 
        self.overrideEnv('EMAIL', None)
146
 
        self.overrideAttr(config, '_auto_user_id', lambda: (None, None))
 
141
        override_whoami(self)
147
142
        global_conf = config.GlobalStack()
148
 
        self.assertRaises(config.NoWhoami, global_conf.get, 'email')
 
143
        self.assertRaises(errors.NoWhoami, global_conf.get, 'email')
149
144
 
150
145
    def test_whoami_nonbranch_directory(self):
151
146
        """Test --directory mentioning a non-branch directory."""