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.assertEquals("keep:99999999999999999999999999999991+99/hw.py",
27 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py"))
29 self.assertEquals("keep:99999999999999999999999999999991+99/hw.py",
30 cf.urljoin("keep:99999999999999999999999999999991+99/", "hw.py"))
32 self.assertEquals("keep:99999999999999999999999999999991+99/hw.py#main",
33 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py#main"))
35 self.assertEquals("keep:99999999999999999999999999999991+99/hw.py#main",
36 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py", "#main"))
38 self.assertEquals("keep:99999999999999999999999999999991+99/dir/hw.py#main",
39 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "#main"))
41 self.assertEquals("keep:99999999999999999999999999999991+99/dir/wh.py",
42 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "wh.py"))
44 self.assertEquals("keep:99999999999999999999999999999991+99/wh.py",
45 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py"))
47 self.assertEquals("keep:99999999999999999999999999999991+99/wh.py#main",
48 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py#main"))
50 self.assertEquals("keep:99999999999999999999999999999991+99/wh.py",
51 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py#main", "wh.py"))
53 self.assertEquals("keep:99999999999999999999999999999992+99",
54 cf.urljoin("keep:99999999999999999999999999999991+99", "keep:99999999999999999999999999999992+99"))
56 self.assertEquals("keep:99999999999999999999999999999991+99/dir/wh.py",
57 cf.urljoin("keep:99999999999999999999999999999991+99/dir/", "wh.py"))
59 def test_resolver(self):