test_resolve_backend.py (1029B)
1 import unittest 2 from ungana.store.fs_store import UnganaFSStore 3 from ungana.store.resolve import resolve_backend_store 4 from ungana.store.wala_store import UnganaWalaStore 5 6 7 class TestResolveBackendStore(unittest.TestCase): 8 9 def test_resolve_fs_store_file_scheme(self): 10 store = resolve_backend_store("file:///tmp/data") 11 self.assertIsInstance(store, UnganaFSStore) 12 13 def test_resolve_fs_store_no_scheme(self): 14 store = resolve_backend_store("/tmp/data") 15 self.assertIsInstance(store, UnganaFSStore) 16 17 def test_resolve_wala_store_http(self): 18 store = resolve_backend_store("http://wala.ungana.com/storage") 19 self.assertIsInstance(store, UnganaWalaStore) 20 21 def test_resolve_wala_store_https(self): 22 store = resolve_backend_store("https://wala.ungana.com/storage") 23 self.assertIsInstance(store, UnganaWalaStore) 24 25 def test_resolve_invalid_scheme(self): 26 with self.assertRaises(ValueError): 27 resolve_backend_store("ftp://walaaaas.com/storage")