Added schema option to define in the integration tests
This commit is contained in:
@@ -8,12 +8,13 @@ from helpers.import_helper import ImportHelper
|
||||
|
||||
|
||||
def main():
|
||||
opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "host="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "host=", "schema="])
|
||||
|
||||
if len(args) < 2:
|
||||
usage()
|
||||
sys.exit()
|
||||
|
||||
schema = "https"
|
||||
host = "cartodb.com"
|
||||
username = args[0]
|
||||
api_key = args[1]
|
||||
@@ -24,26 +25,31 @@ def main():
|
||||
sys.exit()
|
||||
elif o in ("--host"):
|
||||
host = opts[0][1]
|
||||
elif o in ("--schema"):
|
||||
schema = opts[1][1]
|
||||
else:
|
||||
assert False, "unhandled option"
|
||||
|
||||
try:
|
||||
table_name = ImportHelper.import_test_dataset(username, api_key, host)
|
||||
set_environment_variables(username, api_key, table_name, host)
|
||||
table_name = ImportHelper.import_test_dataset(username, api_key, host,
|
||||
schema)
|
||||
set_environment_variables(username, api_key, table_name, host, schema)
|
||||
execute_tests()
|
||||
except Exception as e:
|
||||
print e.message
|
||||
sys.exit(1)
|
||||
finally:
|
||||
clean_environment_variables()
|
||||
ImportHelper.clean_test_dataset(username, api_key, table_name, host)
|
||||
ImportHelper.clean_test_dataset(username, api_key, table_name, host,
|
||||
schema)
|
||||
|
||||
|
||||
def usage():
|
||||
print """Usage: run_tests.py [options] username api_key
|
||||
Options:
|
||||
-h: Show this help
|
||||
--host: take that host as base (by default is cartodb.com)"""
|
||||
--host: take that host as base (by default is cartodb.com)
|
||||
--schema: define the url schema [http/https] (by default https)"""
|
||||
|
||||
|
||||
def execute_tests():
|
||||
@@ -59,11 +65,12 @@ def execute_tests():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def set_environment_variables(username, api_key, table_name, host):
|
||||
def set_environment_variables(username, api_key, table_name, host, schema):
|
||||
os.environ["GEOCODER_API_TEST_USERNAME"] = username
|
||||
os.environ["GEOCODER_API_TEST_API_KEY"] = api_key
|
||||
os.environ["GEOCODER_API_TEST_TABLE_NAME"] = table_name
|
||||
os.environ["GEOCODER_API_TEST_HOST"] = host
|
||||
os.environ["GEOCODER_API_TEST_SCHEMA"] = schema
|
||||
|
||||
|
||||
def clean_environment_variables():
|
||||
@@ -71,6 +78,7 @@ def clean_environment_variables():
|
||||
del os.environ["GEOCODER_API_TEST_API_KEY"]
|
||||
del os.environ["GEOCODER_API_TEST_TABLE_NAME"]
|
||||
del os.environ["GEOCODER_API_TEST_HOST"]
|
||||
del os.environ["GEOCODER_API_TEST_SCHEMA"]
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user