~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_fetch_ghosts.py

  • Committer: Aaron Bentley
  • Date: 2011-01-26 01:11:59 UTC
  • Revision ID: aaron@aaronbentley.com-20110126011159-xsh6z4n8bgxy0k9k
Ignore the_kraken changelogs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib.plugins.bzrtools.fetch_ghosts import GhostFetcher
 
2
from bzrlib.tests import TestCaseWithTransport
 
3
 
 
4
 
 
5
class TestFetchGhosts(TestCaseWithTransport):
 
6
 
 
7
    def prepare_with_ghosts(self):
 
8
        tree = self.make_branch_and_tree('.')
 
9
        tree.commit('rev1', rev_id='rev1-id')
 
10
        tree.set_parent_ids(['rev1-id', 'ghost-id'])
 
11
        tree.commit('rev2')
 
12
        return tree
 
13
 
 
14
    def test_fetch_ghosts_failure(self):
 
15
        tree = self.prepare_with_ghosts()
 
16
        branch = self.make_branch('branch')
 
17
        GhostFetcher(tree.branch, branch).run()
 
18
        self.assertFalse(tree.branch.repository.has_revision('ghost-id'))
 
19
 
 
20
    def test_fetch_ghosts_success(self):
 
21
        tree = self.prepare_with_ghosts()
 
22
        ghost_tree = self.make_branch_and_tree('ghost_tree')
 
23
        ghost_tree.commit('ghost', rev_id='ghost-id')
 
24
        GhostFetcher(tree.branch, ghost_tree.branch).run()
 
25
        self.assertTrue(tree.branch.repository.has_revision('ghost-id'))