This commit is contained in:
@@ -3,6 +3,17 @@ import live_catalog_refresh as refresh
|
||||
|
||||
|
||||
class S4ProgressPayloadTests(unittest.TestCase):
|
||||
def test_source_key_preserves_legacy_directory_identity(self):
|
||||
from source_catalog_import import stable_connection_id
|
||||
from unittest.mock import patch
|
||||
legacy = {'roots': {'company': {'configured_root_id': 'root'}}}
|
||||
with patch.object(refresh.pathlib.Path, 'read_text', return_value=json.dumps(legacy)):
|
||||
self.assertEqual(refresh.dingtalk_root_key(stable_connection_id('dingtalk-company'), 'space'), 'company')
|
||||
self.assertEqual(refresh.dingtalk_root_key(stable_connection_id('dingtalk-space-space'), 'space'), 'space-space')
|
||||
with patch.object(refresh.pathlib.Path, 'read_text', return_value=json.dumps(legacy)):
|
||||
with self.assertRaises(RuntimeError):
|
||||
refresh.dingtalk_root_key('sc-unrecognized', 'space')
|
||||
|
||||
def collect(self, fn):
|
||||
buffer=io.StringIO()
|
||||
with contextlib.redirect_stdout(buffer):
|
||||
|
||||
Reference in New Issue
Block a user