1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
15 import arvados.collection
18 from arvados_cwl.fsaccess import CollectionFetcher
20 class TestUrljoin(unittest.TestCase):
21 def test_urljoin(self):
22 """Test path joining for keep references."""
24 cf = CollectionFetcher({}, None)
26 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py",
27 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py"))
29 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py",
30 cf.urljoin("keep:99999999999999999999999999999991+99/", "hw.py"))
32 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py#main",
33 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py#main"))
35 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py#main",
36 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py", "#main"))
38 self.assertEqual("keep:99999999999999999999999999999991+99/dir/hw.py#main",
39 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "#main"))
41 self.assertEqual("keep:99999999999999999999999999999991+99/dir/wh.py",
42 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "wh.py"))
44 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py",
45 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py"))
47 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py#main",
48 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py#main"))
50 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py",
51 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py#main", "wh.py"))
53 self.assertEqual("keep:99999999999999999999999999999992+99",
54 cf.urljoin("keep:99999999999999999999999999999991+99", "keep:99999999999999999999999999999992+99"))
56 self.assertEqual("keep:99999999999999999999999999999991+99/dir/wh.py",
57 cf.urljoin("keep:99999999999999999999999999999991+99/dir/", "wh.py"))
59 def test_resolver(self):