Example #1
0
def run_js_tests(js_dir, test_filter=None, phase=None):
    import windmill
    windmill.js_framework_active = True
    js_dir = os.path.abspath(os.path.expanduser(js_dir))
    from webenv.applications.file_server import FileServerApplication
    application = FileServerApplication(os.path.abspath(js_dir))
    server.add_namespace('windmill-jstest', application)
    # Build list of files and send to IDE
    base_url = windmill.settings['TEST_URL']+'/windmill-jstest'
    
    js_files = []
    def parse_files(x, directory, files):
        if not os.path.split(directory)[-1].startswith('.'):
            additional_dir = directory.replace(js_dir, '')
            js_files.extend( [additional_dir+'/'+f for f in files if f.endswith('.js')]  )
    os.path.walk(js_dir, parse_files, 'x')
    
    kwargs = {}
    kwargs['files'] = [base_url+f for f in js_files ]
    kwargs['uuid'] = str(uuid.uuid1())
    if test_filter:
        kwargs['filter'] = test_filter
    if phase:
        kwargs['phase'] = phase
    xmlrpc_client.add_command({'method':'commands.jsTests', 'params':kwargs})
Example #2
0
def create_saves_path():
   directory = tempfile.mkdtemp(suffix='.windmill-saves')
   # Mount the fileserver application for tests
   from webenv.applications.file_server import FileServerApplication
   #application = FileServerApplication(os.path.dirname(__file__))
   #XXX
   application = FileServerApplication(directory)
   #server.add_namespace('windmill-unittests', application)
   #XXX
   server.add_namespace('windmill-saves', application)
   windmill.settings['SAVES_PATH'] = directory
   windmill.teardown_directories.append(directory)
Example #3
0
def load_extensions_dir(dirname):
   """Mount the directory and send all javascript file links to the IDE in order to execute those test urls under the jsUnit framework"""
   # Mount the fileserver application for tests
   from webenv.applications.file_server import FileServerApplication
   application = FileServerApplication(os.path.abspath(dirname))
   server.add_namespace('windmill-extensions', application)
   # Build list of files and send to IDE
   base_url = windmill.settings['TEST_URL']+'/windmill-extentions'

   js_files = []
   def parse_files(x, directory, files):
       if not os.path.split(directory)[-1].startswith('.'):
           additional_dir = directory.replace(dirname, '')
           js_files.extend( [additional_dir+'/'+f for f in files if f.endswith('.js')]  )
   os.path.walk(dirname, parse_files, 'x') 

   xmlrpc_client.add_command({'method':'commands.loadExtensions', 
                              'params':{'extensions':[base_url+f for f in js_files ]}})
Example #4
0
def setup_module(module):
    authoring.setup_module(module)

    application = FileServerApplication(os.path.dirname(__file__))
    server.add_namespace('windmill-unittests', application)