Fix some integration tests problems to identify the real reason in the tests dataset import failure
This commit is contained in:
parent
731eb8c74f
commit
b1a703d696
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -11,11 +12,12 @@ class ImportHelper:
|
|||||||
def import_test_dataset(cls, username, api_key, host):
|
def import_test_dataset(cls, username, api_key, host):
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
url = "https://{0}.{1}/api/v1/imports/"\
|
url = "https://{0}.{1}/api/v1/imports/"\
|
||||||
"?type_guessing=false&privacy=public&api_key={2}".format(
|
"?type_guessing=false&privacy=public&api_key={2}".format(
|
||||||
username, host, api_key)
|
username, host, api_key)
|
||||||
dataset = {
|
dataset = {
|
||||||
'file': open('fixtures/geocoder_api_test_dataset.csv', 'rb')}
|
'file': open('fixtures/geocoder_api_test_dataset.csv', 'rb')}
|
||||||
response = requests.post(url, files=dataset)
|
response = requests.post(url, files=dataset)
|
||||||
|
response.raise_for_status()
|
||||||
response_json = json.loads(response.text)
|
response_json = json.loads(response.text)
|
||||||
if not response_json['success']:
|
if not response_json['success']:
|
||||||
print "Error importing the test dataset: {0}".format(response.text)
|
print "Error importing the test dataset: {0}".format(response.text)
|
||||||
@ -40,8 +42,7 @@ class ImportHelper:
|
|||||||
import_data_response = requests.get(import_url)
|
import_data_response = requests.get(import_url)
|
||||||
if import_data_response.status_code != 200:
|
if import_data_response.status_code != 200:
|
||||||
print "Error getting the table name from " \
|
print "Error getting the table name from " \
|
||||||
"the import data: {0}".format(
|
"the import data: {0}".format(import_data_response.text)
|
||||||
import_data_response.text)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
import_data_json = json.loads(import_data_response.text)
|
import_data_json = json.loads(import_data_response.text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user