1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
12 from unittest import mock
16 import arvados.collection
19 from arvados_cwl.fsaccess import CollectionFetcher
21 class TestUrljoin(unittest.TestCase):
22 def test_urljoin(self):
23 """Test path joining for keep references."""
25 cf = CollectionFetcher({}, None)
27 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py",
28 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py"))
30 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py",
31 cf.urljoin("keep:99999999999999999999999999999991+99/", "hw.py"))
33 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py#main",
34 cf.urljoin("keep:99999999999999999999999999999991+99", "hw.py#main"))
36 self.assertEqual("keep:99999999999999999999999999999991+99/hw.py#main",
37 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py", "#main"))
39 self.assertEqual("keep:99999999999999999999999999999991+99/dir/hw.py#main",
40 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "#main"))
42 self.assertEqual("keep:99999999999999999999999999999991+99/dir/wh.py",
43 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "wh.py"))
45 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py",
46 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py"))
48 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py#main",
49 cf.urljoin("keep:99999999999999999999999999999991+99/dir/hw.py", "/wh.py#main"))
51 self.assertEqual("keep:99999999999999999999999999999991+99/wh.py",
52 cf.urljoin("keep:99999999999999999999999999999991+99/hw.py#main", "wh.py"))
54 self.assertEqual("keep:99999999999999999999999999999992+99",
55 cf.urljoin("keep:99999999999999999999999999999991+99", "keep:99999999999999999999999999999992+99"))
57 self.assertEqual("keep:99999999999999999999999999999991+99/dir/wh.py",
58 cf.urljoin("keep:99999999999999999999999999999991+99/dir/", "wh.py"))
60 def test_resolver(self):