@@ -124,10 +124,10 @@ def test_schema_create_missing_definition(self):
124124 """Must provide either definition or definition_file."""
125125
126126 with self .assertRaises (Exception ) as ctx :
127- self ._df_api .schemaCreate ("test_no_def" ,
128- description = "test bad schema"
129- )
130-
127+ self ._df_api .schemaCreate (
128+ "test_no_def" ,
129+ description = "test bad schema"
130+ )
131131 self .assertIn ("Must specify" , str (ctx .exception ))
132132
133133 def test_schema_create_both_definition_sources (self ):
@@ -138,7 +138,30 @@ def test_schema_create_both_definition_sources(self):
138138 "test_both_def" ,
139139 definition = '{"type": "object", "properties": {}}' ,
140140 definition_file = "/tmp/fake.json" ,
141- description = "test bad schema"
141+ )
142+
143+ self .assertIn ("Cannot specify both" , str (ctx .exception ))
144+
145+ def test_schema_update_both_definition_sources (self ):
146+ """Cannot specify both definition and definition_file for schemaUpdate."""
147+
148+ with self .assertRaises (Exception ) as ctx :
149+ self ._df_api .schemaUpdate (
150+ "test_update_both_def" ,
151+ definition = '{"type": "object", "properties": {}}' ,
152+ definition_file = "/tmp/fake.json" ,
153+ )
154+
155+ self .assertIn ("Cannot specify both" , str (ctx .exception ))
156+
157+ def test_schema_revise_both_definition_sources (self ):
158+ """Cannot specify both definition and definition_file for schemaRevise."""
159+
160+ with self .assertRaises (Exception ) as ctx :
161+ self ._df_api .schemaRevise (
162+ "test_revise_both_def" ,
163+ definition = '{"type": "object", "properties": {}}' ,
164+ definition_file = "/tmp/fake.json" ,
142165 )
143166
144167 self .assertIn ("Cannot specify both" , str (ctx .exception ))
@@ -383,6 +406,18 @@ def test_metadata_validate_requires_input(self):
383406
384407 self .assertIn ("Must specify" , str (ctx .exception ))
385408
409+ def test_metadata_validate_metadata_file_cannot_be_opened (self ):
410+ """metadata_file set but file cannot be opened should raise expected error."""
411+
412+ bad_path = "/path/does/not/exist"
413+
414+ with self .assertRaises (Exception ) as ctx :
415+ self ._df_api .metadataValidate ("any_schema" , metadata_file = bad_path )
416+
417+ # The client should surface a clear file-open error that includes the path.
418+ self .assertIn ("Could not open metadata file:" , str (ctx .exception ))
419+ self .assertIn (bad_path , str (ctx .exception ))
420+
386421 def test_schema_create_from_file (self ):
387422 """Test creating a schema from a definition file."""
388423
@@ -432,6 +467,7 @@ def tearDown(self):
432467 suite .addTest (TestDataFedPythonAPISchemaCRUD ("test_metadata_validate_client_rejects_bad_json" ))
433468 suite .addTest (TestDataFedPythonAPISchemaCRUD ("test_metadata_validate_requires_input" ))
434469 suite .addTest (TestDataFedPythonAPISchemaCRUD ("test_schema_create_from_file" ))
470+ suite .addTest (TestDataFedPythonAPISchemaCRUD ("test_metadata_validate_metadata_file_cannot_be_opened" ))
435471 runner = unittest .TextTestRunner ()
436472 result = runner .run (suite )
437473 sys .exit (not result .wasSuccessful ())
0 commit comments