~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Martin Pool
  • Date: 2005-06-22 06:18:20 UTC
  • Revision ID: mbp@sourcefrog.net-20050622061820-9f5613de173e6ab2
- move more tests into bzr selftest

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
# this code was previously in testbzr
29
29
 
30
30
from unittest import TestCase
31
 
from bzrlib.selftest import TestBase
 
31
from bzrlib.selftest import TestBase, InTempDir
32
32
 
33
33
class TestVersion(TestBase):
34
34
    def runTest(self):
49
49
        self.runcmd('bzr commit -h')
50
50
 
51
51
 
52
 
class InTempBranch(TestBase):
53
 
    """Base class for tests run in a temporary branch."""
54
 
    def setUp(self):
55
 
        import os
56
 
        self.branch_dir = os.path.join(self.TEST_DIR, self.__class__.__name__)
57
 
        os.mkdir(self.branch_dir)
58
 
        os.chdir(self.branch_dir)
59
 
        
60
 
    def tearDown(self):
61
 
        import os
62
 
        os.chdir(self.TEST_DIR)
63
 
 
64
 
 
65
 
class InitBranch(InTempBranch):
 
52
class InitBranch(InTempDir):
66
53
    def runTest(self):
67
54
        import os
68
55
        print "%s running in %s" % (self, os.getcwdu())
69
56
        self.runcmd(['bzr', 'init'])
70
 
        
 
57
 
 
58
 
 
59
 
 
60
class UserIdentity(InTempDir):
 
61
    def runTest(self):
 
62
        # this should always identify something, if only "john@localhost"
 
63
        self.runcmd("bzr whoami")
 
64
        self.runcmd("bzr whoami --email")
 
65
        self.assertEquals(self.backtick("bzr whoami --email").count('@'),
 
66
                          1)    
71
67
        
72
68
 
73
69
 
81
77
    s = TestSuite()
82
78
    s.addTests([TestVersion(),
83
79
                InitBranch(),
84
 
                HelpCommands()])
 
80
                HelpCommands(),
 
81
                UserIdentity()])
85
82
    return s