def test_load_data_missing_attribute(sample_data, jm, mock_post_json_data, initial_data): """ Test that no objects is inserted in the object store if there is a missing attribute """ tpda = TreeherderPulseDataAdapter( loaddata=True, durable=False, logdir='logs', rawdata=False, outfile=None ) msg = Message() for data in sample_data.raw_pulse_data[:1]: # change the branch (aka project) name on the raw data, # so that we can use the dataset created by jm # delete the buildid attribute data['payload']['build']['properties'][4][0] = "" data['payload']['build']['properties'][1][1] = jm.project tpda.process_data(data, msg) stored_obj = jm.get_os_dhub().execute( proc="objectstore_test.selects.all") jm.disconnect() assert len(stored_obj) == 0
def test_load_data(sample_data, jm, mock_post_json_data, initial_data, mock_get_resultset): """ Test the ability of TreeherderPulseDataAdapter to load its transformed data through the restful api """ tpda = TreeherderPulseDataAdapter( loaddata=True, durable=False, logdir='logs', rawdata=False, outfile=None ) msg = Message() for data in sample_data.raw_pulse_data[:1]: # change the branch (aka project) name on the raw data, # so that we can use the dataset created by jm data['payload']['build']['properties'][1][1] = jm.project data = tpda.process_data(data, msg) stored_obj = jm.get_os_dhub().execute( proc="objectstore_test.selects.all") jm.disconnect() assert len(stored_obj) == 1