~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Martin Pool
  • Date: 2005-08-18 04:25:42 UTC
  • Revision ID: mbp@sourcefrog.net-20050818042542-6af9da978f695195
- check for email address in BRANCH_ROOT/.bzr/email, so you can 
  easily use different per-project personas

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
 
35
35
class ExternalBase(InTempDir):
36
 
    def runbzr(self, args, retcode=0):
 
36
    def runbzr(self, args, retcode=0,backtick=False):
37
37
        try:
38
38
            import shutil
39
39
            from subprocess import call
43
43
 
44
44
        if isinstance(args, basestring):
45
45
            args = args.split()
46
 
            
47
 
        return self.runcmd(['python', self.BZRPATH,] + args,
 
46
 
 
47
        if backtick:
 
48
            return self.backtick(['python', self.BZRPATH,] + args,
 
49
                           retcode=retcode)
 
50
        else:
 
51
            return self.runcmd(['python', self.BZRPATH,] + args,
48
52
                           retcode=retcode)
49
53
 
50
54
 
121
125
        # this should always identify something, if only "john@localhost"
122
126
        self.runbzr("whoami")
123
127
        self.runbzr("whoami --email")
124
 
        self.assertEquals(self.backtick("bzr whoami --email").count('@'),
125
 
                          1)
 
128
 
 
129
        self.assertEquals(self.runbzr("whoami --email",
 
130
                                      backtick=True).count('@'), 1)
 
131
        
 
132
class UserIdentityBranch(ExternalBase):
 
133
    def runTest(self):
 
134
        # tests branch specific user identity
 
135
        self.runbzr('init')
 
136
        f = file('.bzr/email', 'wt')
 
137
        f.write('Branch Identity <branch@identi.ty>')
 
138
        f.close()
 
139
        whoami = self.runbzr("whoami",backtick=True)
 
140
        whoami_email = self.runbzr("whoami --email",backtick=True)
 
141
        self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>'))
 
142
        self.assertTrue(whoami_email.startswith('branch@identi.ty'))
126
143
 
127
144
 
128
145
class InvalidCommands(ExternalBase):