@@ -207,6 +207,41 @@ def _verifyReadonlyResourceProperties(self, job, resource):
207207 self .assertIsNone (job .user_email )
208208
209209
210+ class TestLoadJobConfig (unittest .TestCase , _Base ):
211+ JOB_TYPE = 'load'
212+
213+ def _make_resource (self , started = False , ended = False ):
214+ resource = super (TestLoadJobConfig , self )._make_resource (
215+ started , ended )
216+ config = resource ['configuration' ]['load' ]
217+ config ['sourceUris' ] = [self .SOURCE1 ]
218+ config ['destinationTable' ] = {
219+ 'projectId' : self .PROJECT ,
220+ 'datasetId' : self .DS_ID ,
221+ 'tableId' : self .TABLE_ID ,
222+ }
223+
224+ return resource
225+
226+ @staticmethod
227+ def _get_target_class ():
228+ from google .cloud .bigquery .job import LoadJobConfig
229+ return LoadJobConfig
230+
231+ def test_schema (self ):
232+ from google .cloud .bigquery .schema import SchemaField
233+ config = self ._get_target_class ()()
234+ full_name = SchemaField ('full_name' , 'STRING' , mode = 'REQUIRED' )
235+ age = SchemaField ('age' , 'INTEGER' , mode = 'REQUIRED' )
236+ config .schema = [full_name , age ]
237+ self .assertEqual (config .schema , [full_name , age ])
238+
239+ def test_api_repr (self ):
240+ resource = self ._make_resource ()
241+ config = self ._get_target_class ().from_api_repr (resource )
242+ self .assertEqual (config .to_api_repr (), resource )
243+
244+
210245class TestLoadJob (unittest .TestCase , _Base ):
211246 JOB_TYPE = 'load'
212247
0 commit comments