示例#1
0
class GitItemCheckoutTest(unittest.TestCase):
    def setUp(self):
        self.sh = MockShell()
        self.item = rgitrepo.GitRepo('wgen-github', 'git://github.com/wgen/'
                , 'rover.git', 'master')

    def test_git_checkout_new_repo(self):
        self.item.checkout(self.sh, 'dest', '')

        #self.assertEquals(2, len(self.sh.history))
        print "history = <%s>" % str(self.sh.history)

        output1 = ['git', 'clone'
                , '--branch', 'master'
                , 'git://github.com/wgen/rover.git'
                , 'dest/rover']
        history1 = self.sh.history[1]
        self.assertEquals(output1, history1)

    def test_git_checkout_pull(self):
        self.sh.undeflow_error = True
        self.sh.seed_result(1)
        self.item.checkout(self.sh, 'dest', '')

        print "history = %s" % str(self.sh.history)

        expectedChdir = 'push_dir(dest/rover)'
        expectedCheckout = ['git', 'checkout', 'master']
        expectedPull = ['git', 'pull']
        self.assertEquals(expectedChdir, self.sh.history[1])
        self.assertEquals(expectedCheckout, self.sh.history[2])
        self.assertEquals(expectedPull, self.sh.history[3])
示例#2
0
 def setUp(self):
     self.sh = MockShell()
     self.item = rgitrepo.GitRepo('wgen-github', 'git://github.com/wgen/'
             , 'rover.git', 'master')