def test_1_upload_ds(self): check_ds_not_exists(TEST_DS_CSV) with open(self.external_datasource_csv_path, 'rb') as f: d = f.read() res = requests.put(f'{HTTP_API_ROOT}/datasources/{TEST_DS_CSV}', files={ 'file': ('data.csv', d, 'text/csv'), 'name': (None, TEST_DS_CSV), 'source_type': (None, 'file'), 'source': (None, 'data.csv') }) assert res.status_code == 200 check_ds_exists(TEST_DS_CSV) check_ds_analyzable(TEST_DS_CSV)
def test_3_create_ds_from_sql_by_http(self): ''' check is no DS with this name create DS analyse it ''' check_ds_not_exists(TEST_DS) data = { "integration_id": TEST_INTEGRATION, "name": TEST_DS, "query": f"select * from test_data.{TEST_DATASET} limit 100;" } res = requests.put(f'{HTTP_API_ROOT}/datasources/{TEST_DS}', json=data) assert res.status_code == 200 check_ds_exists(TEST_DS) check_ds_analyzable(TEST_DS)