コード例 #1
0
ファイル: controller.py プロジェクト: xmonader/allura
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''
    Create clean environment for running tests, includes mongodb connection with "mim" (mongo-in-memory) and sample
    data created.

    A lightweight alternative is setup_config_test which doesn't bootstrap app data.
    '''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    test_file = os.path.join(conf_dir, get_config_file(config))
    """
    # setup our app, from TG quickstart example:
    from tg.util import Bunch
    from gearbox.commands.setup_app import SetupAppCommand
    cmd = SetupAppCommand(Bunch(options=Bunch(verbose_level=1)), Bunch())
    cmd.run(Bunch(config_file='config:{}'.format(test_file), section_name=None))
    """
    # setup our app without depending on gearbox (we still depend on Paste anyway)
    # uses [paste.app_install] entry point which call our setup_app()
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    ew.TemplateEngine.initialize({})

    # remove unnecessary bootstrap tasks, e.g. search indexing
    M.MonQTask.query.remove({'state': 'ready'})
コード例 #2
0
ファイル: controller.py プロジェクト: apache/allura
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''
    Create clean environment for running tests, includes mongodb connection with "mim" (mongo-in-memory) and sample
    data created.

    A lightweight alternative is setup_config_test which doesn't bootstrap app data.
    '''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    test_file = os.path.join(conf_dir, get_config_file(config))
    """
    # setup our app, from TG quickstart example:
    from tg.util import Bunch
    from gearbox.commands.setup_app import SetupAppCommand
    cmd = SetupAppCommand(Bunch(options=Bunch(verbose_level=1)), Bunch())
    cmd.run(Bunch(config_file='config:{}'.format(test_file), section_name=None))
    """
    # setup our app without depending on gearbox (we still depend on Paste anyway)
    # uses [paste.app_install] entry point which call our setup_app()
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    ew.TemplateEngine.initialize({})

    # remove unnecessary bootstrap tasks, e.g. search indexing
    M.MonQTask.query.remove({'state': 'ready'})
コード例 #3
0
ファイル: test_site.py プロジェクト: samsemilia7/SAUCE
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare authz test data
    subm_100 = model.Submission(id=100, filename=u'subm_100', source=u'subm_100',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc1').one(),
        language=model.Language.query.first())
    subm_101 = model.Submission(id=101, filename=u'subm_101', source=u'subm_101',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc2').one(),
        language=model.Language.query.first())
    subm_102 = model.Submission(id=102, filename=u'subm_102', source=u'subm_102',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first())
    model.DBSession.add_all((subm_100, subm_101, subm_102))
    transaction.commit()
コード例 #4
0
ファイル: __init__.py プロジェクト: beckastar/cleaner_markov
    def setUp(self):
        wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
                          relative_to='.')
        self.app = TestApp(wsgiapp)

        # Setting it up:
        test_file = os.path.abspath('test.ini')
        cmd = SetupCommand('setup-app')
        cmd.run([test_file])
コード例 #5
0
ファイル: __init__.py プロジェクト: davidhrbac/cnucnu
    def setUp(self):
        wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
                          relative_to='.')
        self.app = TestApp(wsgiapp)

        # Setting it up:
        test_file = os.path.abspath('test.ini')
        cmd = SetupCommand('setup-app')
        cmd.run([test_file])
コード例 #6
0
ファイル: __init__.py プロジェクト: diegows/xreport
 def setUp(self):
     """Method called by nose before running each test"""
     # Loading the application:
     conf_dir = config.here
     wsgiapp = loadapp("config:test.ini#%s" % self.application_under_test, relative_to=conf_dir)
     self.app = TestApp(wsgiapp)
     # Setting it up:
     test_file = path.join(conf_dir, "test.ini")
     cmd = SetupCommand("setup-app")
     cmd.run([test_file])
コード例 #7
0
ファイル: __init__.py プロジェクト: decause/moksha
 def setUp(self):
     # Loading the application:
     conf_dir = config.here
     wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
                       relative_to=conf_dir)
     self.app = TestApp(wsgiapp)
     # Setting it up:
     test_file = path.join(conf_dir, 'test.ini')
     cmd = SetupCommand('setup-app')
     cmd.run([test_file])
コード例 #8
0
ファイル: __init__.py プロジェクト: decause/moksha
def setup_app(application): 
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#%s' % application,
                      relative_to=conf_dir)
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])
    return app
コード例 #9
0
ファイル: test_menu_items.py プロジェクト: sleeepyjack/SAUCE
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])
コード例 #10
0
 def setUp(self):
     """Method called by nose before running each test"""
     # Loading the application:
     conf_dir = config.here
     wsgiapp = loadapp(
         "config:test.ini#%s" % self.application_under_test, relative_to=conf_dir
     )
     self.app = TestApp(wsgiapp)
     # Setting it up:
     test_file = path.join(conf_dir, "test.ini")
     cmd = SetupCommand("setup-app")
     cmd.run([test_file])
コード例 #11
0
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare authz test data
    subm_100 = model.Submission(
        id=100,
        filename=u'subm_100',
        source=u'subm_100',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc1').one(),
        language=model.Language.query.first(),
        judgement=model.Judgement(
            tutor=model.User.query.filter_by(user_name='tutor1').one(),
            corrected_source=u'subm-100',
            comment=u'Good good',
            annotations={1: 'No no no'},
            grade=3.14))
    model.DBSession.add(subm_100)
    subm_101 = model.Submission(
        id=101,
        filename=u'subm_101',
        source=u'subm_101',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc2').one(),
        language=model.Language.query.first())
    model.DBSession.add(subm_101)
    subm_102 = model.Submission(
        id=102,
        filename=u'subm_102',
        source=u'subm_102',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first())
    model.DBSession.add(subm_102)
    subm_103 = model.Submission(
        id=103,
        filename=u'subm_103',
        source=u'subm_103',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first(),
        public=True)
    model.DBSession.add(subm_103)
    transaction.commit()
コード例 #12
0
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''Create clean environment for running tests'''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    ew.TemplateEngine.initialize({})
    test_file = os.path.join(conf_dir, get_config_file(config))
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # run all tasks, e.g. indexing from bootstrap operations
    while M.MonQTask.run_ready('setup'):
        ThreadLocalORMSession.flush_all()
コード例 #13
0
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''Create clean environment for running tests'''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    ew.TemplateEngine.initialize({})
    test_file = os.path.join(conf_dir, get_config_file(config))
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # run all tasks, e.g. indexing from bootstrap operations
    while M.MonQTask.run_ready('setup'):
        ThreadLocalORMSession.flush_all()
コード例 #14
0
ファイル: controller.py プロジェクト: phraniiac/allura
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''
    Create clean environment for running tests.

    A lightweight alternative is setup_config_test which doesn't bootstrap app data.
    '''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    test_file = os.path.join(conf_dir, get_config_file(config))
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])
    ew.TemplateEngine.initialize({})

    # remove unnecessary bootstrap tasks, e.g. search indexing
    M.MonQTask.query.remove({'state': 'ready'})
コード例 #15
0
ファイル: controller.py プロジェクト: joequant/allura
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    """
    Create clean environment for running tests.

    A lightweight alternative is setup_config_test which doesn't bootstrap app data.
    """
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    test_file = os.path.join(conf_dir, get_config_file(config))
    cmd = SetupCommand("setup-app")
    cmd.run([test_file])
    ew.TemplateEngine.initialize({})

    # remove unnecessary bootstrap tasks, e.g. search indexing
    M.MonQTask.query.remove({"state": "ready"})
コード例 #16
0
ファイル: controller.py プロジェクト: brondsem/allura
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
    '''
    Create clean environment for running tests, includes mongodb connection with "mim" (mongo-in-memory) and sample
    data created.

    A lightweight alternative is setup_config_test which doesn't bootstrap app data.
    '''
    try:
        conf_dir = tg.config.here
    except AttributeError:
        conf_dir = os.getcwd()
    test_file = os.path.join(conf_dir, get_config_file(config))
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])
    ew.TemplateEngine.initialize({})

    # remove unnecessary bootstrap tasks, e.g. search indexing
    M.MonQTask.query.remove({'state': 'ready'})
コード例 #17
0
ファイル: test_model_urls.py プロジェクト: sleeepyjack/SAUCE
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare nullable=True test data
    u = model.User(id=0,
                   user_name='empty',
                   email_address='empty',
                   display_name=None,
                   created=None)
    e = model.Course(id=0,
                     name='Empty',
                     _url='empty',
                     description=None,
                     enabled=True)
    s = model.Sheet(id=0,
                    name='Empty',
                    sheet_id='0',
                    event=e,
                    description=None)
    a = model.Assignment(id=0,
                         name='Empty',
                         assignment_id='0',
                         sheet=s,
                         description=None,
                         timeout=None)
    ss = model.Submission(id=0,
                          user=u,
                          assignment=a,
                          filename=None,
                          source=None,
                          language=None)
    j = model.Judgement(id=0, submission=ss, tutor=u)
    model.DBSession.add_all((u, e, a, s, ss, j))
    transaction.commit()
コード例 #18
0
ファイル: test_model_urls.py プロジェクト: Ayutac/SAUCE
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare nullable=True test data
    u = model.User(id=0, user_name='empty', email_address='empty', display_name=None, created=None)
    e = model.Course(id=0, name='Empty', _url='empty', description=None, enabled=True)
    s = model.Sheet(id=0, name='Empty', sheet_id='0', event=e, description=None)
    a = model.Assignment(id=0, name='Empty', assignment_id='0', sheet=s, description=None, timeout=None)
    ss = model.Submission(id=0, user=u, assignment=a, filename=None, source=None, language=None)
    j = model.Judgement(id=0, submission=ss, tutor=u)
    model.DBSession.add_all((u, e, a, s, ss, j))
    transaction.commit()
コード例 #19
0
ファイル: test_site.py プロジェクト: Ayutac/SAUCE
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare authz test data
    subm_100 = model.Submission(id=100, filename=u'subm_100', source=u'subm_100',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc1').one(),
        language=model.Language.query.first(),
        judgement=model.Judgement(
            tutor=model.User.query.filter_by(user_name='tutor1').one(),
            corrected_source=u'subm-100', comment=u'Good good',
            annotations={1: 'No no no'}, grade=3.14))
    model.DBSession.add(subm_100)
    subm_101 = model.Submission(id=101, filename=u'subm_101', source=u'subm_101',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc2').one(),
        language=model.Language.query.first())
    model.DBSession.add(subm_101)
    subm_102 = model.Submission(id=102, filename=u'subm_102', source=u'subm_102',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first())
    model.DBSession.add(subm_102)
    subm_103 = model.Submission(id=103, filename=u'subm_103', source=u'subm_103',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first(),
        public=True)
    model.DBSession.add(subm_103)
    transaction.commit()
コード例 #20
0
def setUpModule():
    # Loading the application:
    conf_dir = config.here
    wsgiapp = loadapp('config:test.ini#main_without_authn',
                      relative_to=conf_dir)
    global app
    app = TestApp(wsgiapp)
    # Setting it up:
    test_file = path.join(conf_dir, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])

    # Prepare authz test data
    subm_100 = model.Submission(
        id=100,
        filename=u'subm_100',
        source=u'subm_100',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc1').one(),
        language=model.Language.query.first())
    subm_101 = model.Submission(
        id=101,
        filename=u'subm_101',
        source=u'subm_101',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studentc2').one(),
        language=model.Language.query.first())
    subm_102 = model.Submission(
        id=102,
        filename=u'subm_102',
        source=u'subm_102',
        assignment=model.Assignment.query.filter_by(id=2).one(),
        user=model.User.query.filter_by(user_name='studente1').one(),
        language=model.Language.query.first())
    model.DBSession.add_all((subm_100, subm_101, subm_102))
    transaction.commit()
コード例 #21
0
ファイル: __init__.py プロジェクト: gabor-konrad/Skylines
def setup_app():
    test_file = path.join(config.here, 'test.ini')
    cmd = SetupCommand('setup-app')
    cmd.run([test_file])