Merge branch '11369-dispatch-mem' refs #11369
[arvados.git] / sdk / cwl / tests / test_fsaccess.py
1 import functools
2 import mock
3 import sys
4 import unittest
5 import json
6 import logging
7 import os
8
9 import arvados
10 import arvados.keep
11 import arvados.collection
12 import arvados_cwl
13
14 from cwltool.pathmapper import MapperEnt
15 from .mock_discovery import get_rootDesc
16
17 from arvados_cwl.fsaccess import CollectionCache
18
19 class TestFsAccess(unittest.TestCase):
20     @mock.patch("arvados.collection.CollectionReader")
21     def test_collection_cache(self, cr):
22         cache = CollectionCache(mock.MagicMock(), mock.MagicMock(), 4)
23         c1 = cache.get("99999999999999999999999999999991+99")
24         c2 = cache.get("99999999999999999999999999999991+99")
25         self.assertIs(c1, c2)
26         self.assertEqual(1, cr.call_count)
27         c3 = cache.get("99999999999999999999999999999992+99")
28         self.assertEqual(2, cr.call_count)