Fix some integration tests problems to identify the real reason in the tests dataset import failure

This commit is contained in:
Mario de Frutos 2016-02-03 15:46:05 +01:00
parent 731eb8c74f
commit b1a703d696

View File

@ -1,6 +1,7 @@
import os import os
import requests import requests
import json import json
import sys
import time import time
@ -16,6 +17,7 @@ class ImportHelper:
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)