comparison tests/test_fetch_command.py @ 14:d78dbf88c13d

Started a meaningful test suite.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Oct 2008 18:42:43 -0500
parents
children db32dee803a8
comparison
equal deleted inserted replaced
13:e60bd31f58a7 14:d78dbf88c13d
1 import os
2 import shutil
3 import tempfile
4 import unittest
5
6 from mercurial import hg
7 from mercurial import ui
8 from mercurial import node
9
10 import fetch_command
11 import util
12
13 class TestBasicRepoLayout(unittest.TestCase):
14 def setUp(self):
15 self.oldwd = os.getcwd()
16 self.tmpdir = tempfile.mkdtemp('svnwrap_test')
17 self.repo_path = '%s/testrepo' % self.tmpdir
18 self.wc_path = '%s/testrepo_wc' % self.tmpdir
19
20 def tearDown(self):
21 shutil.rmtree(self.tmpdir)
22 os.chdir(self.oldwd)
23
24 def test_fresh_fetch_single_rev(self):
25 util.load_svndump_fixture(self.repo_path, 'single_rev.svndump')
26 fetch_command.fetch_revisions(ui.ui(),
27 svn_url='file://%s' % self.repo_path,
28 hg_repo_path=self.wc_path)
29 repo = hg.repository(ui.ui(), self.wc_path)
30 self.assertEqual(node.hex(repo['tip'].node()),
31 'a47d0ce778660a91c31bf2c21c448e9ee296ac90')
32 self.assertEqual(repo['tip'], repo[0])
33
34 def test_fresh_fetch_two_revs(self):
35 util.load_svndump_fixture(self.repo_path, 'two_revs.svndump')
36 fetch_command.fetch_revisions(ui.ui(),
37 svn_url='file://%s' % self.repo_path,
38 hg_repo_path=self.wc_path)
39 repo = hg.repository(ui.ui(), self.wc_path)
40 # TODO there must be a better way than repo[0] for this check
41 self.assertEqual(node.hex(repo[0].node()),
42 'a47d0ce778660a91c31bf2c21c448e9ee296ac90')
43 self.assertEqual(node.hex(repo['tip'].node()),
44 'bf3767835b3b32ecc775a298c2fa27134dd91c11')
45 self.assertEqual(repo['tip'], repo[1])