@@ -490,51 +490,39 @@ def test_run_entrypoint_empty_dataspace_value(self):
490490 os .unlink (config_json_path )
491491
492492
493- class TestReadSourceFromPermissions :
494- """`_read_source_from_permissions ` extracts the streaming read source from
495- config.json's `permissions.read` ."""
493+ class TestReadStreamingSource :
494+ """`_read_streaming_source ` extracts the source name from config.json's
495+ `streamingSource` object ."""
496496
497- def test_returns_single_dlo (self ):
498- from datacustomcode .run import _read_source_from_permissions
497+ def test_returns_dlo_name (self ):
498+ from datacustomcode .run import _read_streaming_source
499499
500- config_json = {"permissions " : {"read " : { "dlo" : [ "Account_std__dll" ]} }}
501- assert _read_source_from_permissions (config_json ) == "Account_std__dll "
500+ config_json = {"streamingSource " : {"type " : "dlo" , "name" : "Account_Home__dll" }}
501+ assert _read_streaming_source (config_json ) == "Account_Home__dll "
502502
503- def test_returns_single_dmo (self ):
504- from datacustomcode .run import _read_source_from_permissions
505-
506- config_json = {"permissions" : {"read" : {"dmo" : ["Account_model__dlm" ]}}}
507- assert _read_source_from_permissions (config_json ) == "Account_model__dlm"
508-
509- def test_dlo_preferred_when_both_present (self ):
510- from datacustomcode .run import _read_source_from_permissions
503+ def test_returns_dmo_name (self ):
504+ from datacustomcode .run import _read_streaming_source
511505
512506 config_json = {
513- "permissions " : {"read " : { "dlo" : [ "the_dll" ] , "dmo " : [ "the_dlm" ]} }
507+ "streamingSource " : {"type " : "dmo" , "name " : "AccountTransformed__dlm" }
514508 }
515- assert _read_source_from_permissions (config_json ) == "the_dll"
516-
517- def test_returns_first_of_multiple (self ):
518- from datacustomcode .run import _read_source_from_permissions
519-
520- config_json = {"permissions" : {"read" : {"dlo" : ["first__dll" , "second__dll" ]}}}
521- assert _read_source_from_permissions (config_json ) == "first__dll"
509+ assert _read_streaming_source (config_json ) == "AccountTransformed__dlm"
522510
523511 @pytest .mark .parametrize (
524512 "config_json" ,
525513 [
526514 {},
527- {"permissions " : None },
528- {"permissions " : {}},
529- {"permissions " : {"read " : None }},
530- {"permissions " : {"read " : {} }},
531- {"permissions " : {"read " : { "dlo" : []} }},
515+ {"streamingSource " : None },
516+ {"streamingSource " : {}},
517+ {"streamingSource " : {"type " : "dlo" }},
518+ {"streamingSource " : {"type " : "dlo" , "name" : "" }},
519+ {"streamingSource " : {"type " : "dlo" , "name" : None }},
532520 ],
533521 )
534522 def test_returns_none_when_absent_or_empty (self , config_json ):
535- from datacustomcode .run import _read_source_from_permissions
523+ from datacustomcode .run import _read_streaming_source
536524
537- assert _read_source_from_permissions (config_json ) is None
525+ assert _read_streaming_source (config_json ) is None
538526
539527
540528class TestStreamingSourceScenarios :
@@ -575,15 +563,15 @@ def _run_capturing_streaming_source(self, config_json_body):
575563 if os .path .exists ("streaming_source_output.txt" ):
576564 os .unlink ("streaming_source_output.txt" )
577565
578- def test_streaming_source_set_from_permissions_read (self ):
566+ def test_streaming_source_set_from_streaming_source_field (self ):
579567 content = self ._run_capturing_streaming_source (
580568 {
581569 "dataspace" : "default" ,
582- "permissions " : {"read " : { "dlo" : [ "Account_std__dll" ]} },
570+ "streamingSource " : {"type " : "dlo" , "name" : "Account_Home__dll" },
583571 }
584572 )
585- assert "streaming_source: Account_std__dll " in content
573+ assert "streaming_source: Account_Home__dll " in content
586574
587- def test_streaming_source_none_for_batch_without_read (self ):
575+ def test_streaming_source_none_for_batch_without_field (self ):
588576 content = self ._run_capturing_streaming_source ({"dataspace" : "default" })
589577 assert "streaming_source: None" in content
0 commit comments