Exemplo n.º 1
0
    def test_am_dry_run(self):
        mbox = 'dummy mbox file'
        git = Git(True, self.dummy_output)
        git.am(mbox)

        gitrepo = stubslib.GitRepository.load(self.datadir)
        self.assertEquals(len(gitrepo.get_commits()), 0)
Exemplo n.º 2
0
    def test_am(self):
        mbox = 'dummy mbox file'
        sha1sum = hashlib.sha1(mbox).hexdigest()

        git = Git(False, self.dummy_output)
        git.am(mbox)

        f = open(os.path.join(self.datadir, 'objects', sha1sum), 'r')
        self.assertEquals(f.read(), mbox)
        f.close()
Exemplo n.º 3
0
    def test_get_branch(self):
        f = open(os.path.join(self.datadir, 'branches'), 'w')
        f.write('  aaa\n')
        f.write('  bbb\n')
        f.write('* foo\n')
        f.write('  ccc\n')
        f.close()

        git = Git(False, self.dummy_output)
        branch = git.get_branch()

        self.assertEqual(branch, 'foo')
Exemplo n.º 4
0
    def test_get_branch(self):
        gitrepo = stubslib.GitRepository.load(self.datadir)

        gitrepo.create_branch('bbb')
        gitrepo.create_branch('foo')
        gitrepo.create_branch('ccc')

        gitrepo.change_branch('foo')

        git = Git(self.dummy_output)
        branch = git.get_branch()

        self.assertEqual(branch, 'foo')
Exemplo n.º 5
0
    def test_am(self):
        mbox = '''From nobody
From: Ed Example <[email protected]
Subject: [PATCH] dummy test
Date: Date: Thu,  10 Feb 2011 15:23:31 +0300

foo body
'''
        sha1sum = hashlib.sha1(mbox).hexdigest()

        git = Git(False, self.dummy_output)
        git.am(mbox)

        gitrepo = stubslib.GitRepository.load(self.datadir)
        self.assertEquals(gitrepo.get_commits()[0].mbox, mbox)
Exemplo n.º 6
0
    def test_am(self):
        mbox = '''From nobody
From: Ed Example <[email protected]
Subject: [PATCH] dummy test
Date: Date: Thu,  10 Feb 2011 15:23:31 +0300

foo body
'''
        # TODO: is sha1sum useless?
        sha1sum = hashlib.sha1(mbox.encode('utf-8')).hexdigest()
        assert sha1sum  # to shutup pyflakes

        git = Git(self.dummy_output)
        git.am(mbox)

        gitrepo = stubslib.GitRepository.load(self.datadir)
        self.assertEqual(gitrepo.get_commits()[0].mbox, mbox)
Exemplo n.º 7
0
    def test_am_dry_run(self):
        mbox = 'dummy mbox file'
        git = Git(True, self.dummy_output)
        git.am(mbox)

        self.assertFalse(os.path.exists(os.path.join(self.datadir, 'stub-git-am-s')))