def test_no_ssl_certificates():
	"""
	Verify that the SSL certificates are mandatory
	"""
	util.clean_home_folder()
	util.copy_database('rest_test_db.json')

	assert util.KIWIBES_ERRORS['ERROR_HTTPS_CERTS_FAIL'] == util.launch_blocking([util.KIWIBES_HOME])
def setup_cleanup():
	"""
	Setup the Kiwibes server to start with a fresh database,
	then run the test and finally kill the server
	"""
	# setup the home folder and launch the Kiwibes server
	util.clean_home_folder()
	util.copy_database('rest_test_db.json')
	util.copy_auth_tokens('demo.auth')
	util.copy_ssl_certs()
	
	kiwibes = util.launch_non_blocking([util.KIWIBES_HOME,'-l','2','-d','1'])

	# run the test case
	yield

	# cleanup and backup the db
	kiwibes.terminate()
def test_invalid_database():
	"""
	Startup with invalid database files
	"""
	# no database is available
	util.clean_home_folder()

	assert util.KIWIBES_ERRORS['ERROR_NO_DATABASE_FILE'] == util.launch_blocking([util.KIWIBES_HOME])

	# database with a JSON syntax error
	util.clean_home_folder()
	util.copy_database('syntax_error.json')

	assert util.KIWIBES_ERRORS['ERROR_JSON_PARSE_FAIL'] == util.launch_blocking([util.KIWIBES_HOME])

	# database where a job as incomplete data
	util.clean_home_folder()
	util.copy_database('job_incomplete_data.json')

	assert util.KIWIBES_ERRORS['ERROR_JOB_DESCRIPTION_INVALID'] == util.launch_blocking([util.KIWIBES_HOME])