def test_clone_from_cache_bad_namespace(tmpdir): """ this should fail since the namespace is invalid.""" latest_artifact_url = checkout.urljoin(checkout.TC_INDEX, 'task', 'bar') with mocked_urllib2({'http://bad.url/': '{"taskId":"baz"}'}, no_size=True): assert not checkout.clone_from_cache('foo', 'bar', None, tmpdir.path)
def test_urljoin_no_slash(): """ arbitrary number of elements should be joined with a forward slash""" test_input = ['foo', 'bar', 'baz', 'qux'] expected = 'foo/bar/baz/qux' actual = checkout.urljoin(*test_input) eq_(expected, actual)
def test_urljoin_right_slashes(): """ arbitrary number of elements followed by a slash should be joined with a single slash""" test_input = ['foo/', 'bar', 'baz/', 'qux'] expected = 'foo/bar/baz/qux' actual = checkout.urljoin(*test_input) eq_(expected, actual)