~codetree-maintainers/codetree/master

« back to all changes in this revision

Viewing changes to tests/test_handlers.py

  • Committer: Matthew Wedgwood
  • Date: 2013-09-18 23:10:44 UTC
  • Revision ID: git-v1:5eee79d5dbc01b85c588ee97bb9a9ebf8cb2c7ef
Improve error handling and control over error results

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
)
26
26
 
27
27
BzrURLs = (
28
 
    "bzr://example.com/foo",
 
28
    "bzr://example.com/foo/",
 
29
    "lp:debian/apt/",
 
30
    "bzr+ssh://bazaar.launchpad.net/~foo/bar/trunk/",
 
31
    "bzr+http://example.com/foo/",
 
32
    "bzr+https://example.com/foo/",
29
33
    "lp:debian/apt",
30
 
    "bzr+ssh://bazaar.launchpad.net/~foo/bar/trunk",
31
 
    "bzr+http://example.com/foo",
32
 
    "bzr+https://example.com/foo",
33
34
)
34
35
 
35
36
HttpURLs = (
51
52
    for call_args in mock.call_args_list:
52
53
        if call_args[0][0] == cmd:
53
54
            return True
 
55
    return False
54
56
 
55
57
 
56
58
def shellcmd(cmd):
188
190
        self.addCleanup(shutil.rmtree, child_tmp)
189
191
 
190
192
        # is same
191
 
        child = os.path.join(child_tmp, "child")
 
193
        child = os.path.join(child_tmp, "child") + "/"
192
194
        shellcmd("bzr branch {} {}".format(parent, child))
193
195
        self.assertTrue(bh.is_same_branch(child))
194
196
 
195
197
        # is not the same
196
198
        nonchild = os.path.join(child_tmp, "nonchild")
197
199
        shellcmd("bzr branch {} {}".format(child, nonchild))
198
 
        self.assertFalse(bh.is_same_branch(nonchild))
 
200
        self.assertFalse(bh.is_same_branch(nonchild), "test: is not same")
199
201
 
200
202
        # is standalone
201
203
        stdalone = os.path.join(child_tmp, "stdalone")
202
204
        shellcmd("bzr init {}".format(stdalone))
203
 
        self.assertFalse(bh.is_same_branch(stdalone))
 
205
        self.assertFalse(bh.is_same_branch(stdalone), "test: is standalone")
204
206
 
205
207
 
206
208
class TestLocalHandler(TestCase):