Esempio n. 1
0
def runTest(request, fullpath):
	path = contrib.normpath(request.REQUEST["path"])
	context_name = request.REQUEST.get("context", None)
	ctx = context.get(fullpath, section=context_name)

	log.info('run test %s with context %s' % (path, context_name))
	server = request.get_host()
	contextjs = context.render(path, ctx, server)
	log.debug('contextJS: '+ contextjs)

	clean_path = contrib.get_relative_clean_path(path)
	target = contrib.get_runner_url(ctx, server)
	log.info('target of test %s is %s' % (clean_path, target))

	tools.savetest(request.REQUEST.get('content', None), fullpath)
	test_content = request.REQUEST.get("content", open(fullpath, 'r').read())

	#if contrib.target_is_remote( target, server):
	#	log.debug('TARGET: %s, %s' % ( target, server ))
	#	url = "http://%s/%s" % (target, settings.UPLOAD_TESTS_CMD)
	#	saveRemoteContext(os.path.dirname(clean_path), contextjs, url, ctx)
	#	distributor.saveTestSatelliteScripts(url, path, ctx)
	#	distributor.sendContentToRemote(clean_path, test_content, url, ctx)
	#	url = "http://%s/%s?path=/%s" % (target, settings.EXEC_TESTS_CMD, clean_path)
	#else:
	#	saveLocalContext(fullpath, contextjs)
	#	url = "http://%s/%s?path=/%s" % (target, settings.EXEC_TESTS_CMD, clean_path)
	saveLocalContext(fullpath, contextjs)
	if coffee(path):
		path = coffeescript.compile(test_content, path, fullpath)
	url = "http://%s/%s?server=%s&path=/%s" % (target, settings.EXEC_TESTS_CMD, server, path)
	log.info("redirect to run test %s" % url)
	return HttpResponseRedirect(url)
Esempio n. 2
0
def uploadFolderToRemote(folder_content, virtual_path, document_root, ctx, url, name):
	for file_ in folder_content:
		file_path = os.path.join(virtual_path, file_)
		rel_path = contrib.get_relative_clean_path(file_path)
		fullpath = contrib.get_full_path(document_root, file_path)
		result = uploadContentToRemote(url, fullpath, rel_path, ctx)
		log.info("%s %s is saved: %s" % (name, file_path, result))
Esempio n. 3
0
def runSuite(request, fullpath):
	path = contrib.normpath(request.REQUEST["path"])
	context_name = request.REQUEST["context"]
	ctx = context.get(fullpath, section=context_name)

	log.info('run suite %s with context %s' % (path, context_name))
	server = request.get_host();
	compileSuiteCoffee(path, fullpath)
	contextjs = context.render(path, ctx, server)

	clean_path = contrib.get_relative_clean_path(path)
	target = contrib.get_runner_url(ctx, server)
	log.info('target of suite %s is %s' % (clean_path, target))

	#if contrib.target_is_remote( target, server):
	#	url = "http://%s/%s" % (target, settings.UPLOAD_TESTS_CMD)
	#	saveRemoteContext(clean_path, contextjs, url, ctx)
	#	distributor.saveSuiteAllTests(url, path, ctx)
	#	distributor.saveTestSatelliteScripts(url, path, ctx)
	#	url = "http://%s/%s?suite=/%s" % ( target, settings.EXEC_TESTS_CMD, clean_path )
	#else:
	#	saveLocalContext(fullpath, contextjs)
	#	url = "http://%s/%s?suite=/%s" % ( target, settings.EXEC_TESTS_CMD, clean_path )

	saveLocalContext(fullpath, contextjs)
	url = "http://%s/%s?server=%s&path=/%s" % ( target, settings.EXEC_TESTS_CMD, server, path )
	log.info("redirect to run suite %s" % url)
	return HttpResponseRedirect( url )
Esempio n. 4
0
def runSuite(request, fullpath):
	path = contrib.normpath(request.REQUEST["path"])
	context_name = request.REQUEST["context"]
	ctx = context.get(fullpath, section=context_name)

	log.info('run suite %s with context %s' % (path, context_name))
	server = request.get_host();
	compileSuiteCoffee(path, fullpath)
	contextjs = context.render(path, ctx, server, context_name)

	clean_path = contrib.get_relative_clean_path(path)
	target = contrib.get_runner_url(ctx, server)
	log.info('target of suite %s is %s' % (clean_path, target))

	saveLocalContext(fullpath, contextjs)
	url = "http://%s/%s?server=%s&path=/%s" % ( target, settings.EXEC_TESTS_CMD, server, path )
	log.info("redirect to run suite %s" % url)
	return HttpResponseRedirect( url )
Esempio n. 5
0
def runTest(request, fullpath):
	path = contrib.normpath(request.REQUEST["path"])
	context_name = request.REQUEST.get("context", None)
	ctx = context.get(fullpath, section=context_name)

	log.info('run test %s with context %s' % (path, context_name))
	server = request.get_host()
	contextjs = context.render(path, ctx, server, context_name)
	log.debug('contextJS: '+ contextjs)

	clean_path = contrib.get_relative_clean_path(path)
	target = contrib.get_runner_url(ctx, server)
	log.info('target of test %s is %s' % (clean_path, target))

	tools.savetest(request.REQUEST.get('content', None), fullpath)
	test_content = request.REQUEST.get("content", open(fullpath, 'r').read())
	
	saveLocalContext(fullpath, contextjs)
	if coffee(path):
		path = coffeescript.compile2js(test_content, path, fullpath)
	url = "http://%s/%s?server=%s&path=/%s" % (target, settings.EXEC_TESTS_CMD, server, path)
	log.info("redirect to run test %s" % url)
	return HttpResponseRedirect(url)