示例#1
0
文件: base.py 项目: lmacken/moksha
def setup_quickstart(template, templates, template_vars, args):
    command = CreateDistroCommand('MokshaQuickStartUnitTest')
    command.verbose = False
    command.simulate = False
    command.options = Options()
    command.interactive=False
    command.args=[
            'mokshatest', '--package=mokshatest',
            '--template=moksha.master',
            ]
    for t in templates:
        command.args.append('--template=%s' % t)

    for arg in args:
        command.args.append('%s=%s' % (arg, args[arg]))

    proj_dir = os.path.join(testDataPath, 'mokshatest')
    command.create_template(
            template('mokshatest'),
            proj_dir,
            template_vars)
    command.command()

    subprocess.Popen('paver egg_info', shell=True, stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     cwd=proj_dir).communicate()

    pkg_resources.working_set.add_entry(proj_dir)
    reload(pkg_resources)

    app = loadapp('config:%s' % get_moksha_dev_config(),
                  relative_to=proj_dir)
    return TestApp(app)
    def test01Run(self):
        log.debug("_"*80)
        log.debug("Creating Secured application template ...")
        log.debug("_"*80)
        cmd = CreateDistroCommand(None)
        cmd.default_interactive = False
        cmd.run([self.__class__.SERVICE_CONF_DIR,
                 '-t',
                 self.__class__.SERVICE_TMPL_NAME,
                 '-o',
                 self.__class__.HERE_DIR])

        createdFiles = listdir(self.__class__.SERVICE_CONF_DIRPATH)

        for _file in self.__class__.SERVICE_CONF_DIR_FILES:
            self.assert_(_file in createdFiles, "Missing file %r" % _file)
示例#3
0
    def setUp(self):
        command = CreateDistroCommand('TGQuickStartUnitTest')
        command.verbose = False
        command.simulate = False
        command.options = MochOptions()
        command.interactive=False
        command.args=['TGTest', 'cookiesecret=ChangeME']

        proj_dir = os.path.join(testDataPath, 'TGTest')
        command.create_template(
                TurboGearsTemplate('TGTest'),
                proj_dir,
                self.template_vars)
        command.command()
        
        pkg_resources.working_set.add_entry(proj_dir)
        self.app = loadapp('config:development.ini', relative_to=proj_dir)
        self.app = TestApp(self.app)
示例#4
0
def create_distro_command(interactive=True, args=None):
    """ front-end the CreateDistro command"""
    command = CreateDistroCommand('create')
    command.verbose = 0
    command.simulate = False
    command.interactive = interactive
    command.parse_args(args or [])
    return command
示例#5
0
def create_distro_command(interactive=True, args=None):
    """ front-end the CreateDistro command"""
    command = CreateDistroCommand('create')
    command.verbose = 0
    command.simulate = False
    command.interactive = interactive
    command.parse_args(args or [])
    return command
示例#6
0
def setup_quickstart(template, templates, template_vars, args):
    command = CreateDistroCommand('MokshaQuickStartUnitTest')
    command.verbose = False
    command.simulate = False
    command.options = Options()
    command.interactive = False
    command.args = [
        'mokshatest',
        '--package=mokshatest',
        '--template=moksha.master',
    ]
    for t in templates:
        command.args.append('--template=%s' % t)

    for arg in args:
        command.args.append('%s=%s' % (arg, args[arg]))

    proj_dir = os.path.join(testDataPath, 'mokshatest')
    command.create_template(template('mokshatest'), proj_dir, template_vars)
    command.command()

    subprocess.Popen('paver egg_info',
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     cwd=proj_dir).communicate()

    pkg_resources.working_set.add_entry(proj_dir)
    reload(pkg_resources)

    app = loadapp('config:%s' % get_moksha_dev_config(), relative_to=proj_dir)
    return TestApp(app)
    def setUp(self):
        command = CreateDistroCommand('TGQuickStartUnitTest')
        command.verbose = False
        command.simulate = False
        command.options = MochOptions()
        command.interactive = False
        command.args = ['TGTest', 'cookiesecret=ChangeME']

        proj_dir = os.path.join(testDataPath, 'TGTest')
        command.create_template(TurboGearsTemplate('TGTest'), proj_dir,
                                self.template_vars)
        command.command()

        pkg_resources.working_set.add_entry(proj_dir)
        self.app = loadapp('config:development.ini', relative_to=proj_dir)
        self.app = TestApp(self.app)
示例#8
0
def setup():
    global app
    command = CreateDistroCommand("name")
    command.verbose = True
    command.simulate = False
    command.options = MochOptions()
    command.interactive = False
    command.args = ["TGTest"]
    command.args.append("sqlalchemy=%s" % True)
    command.args.append("sqlobject=%s" % False)
    command.args.append("identity=%s" % False)
    print command
    command.templates = TurboGearsTemplate("TGTest")
    command.create_template(
        TurboGearsTemplate("TGTest"),
        testDataPath + "/TGTest",
        {"package": "TGTest", "project": "tgtest", "egg": "tgtest"},
    )
    command.command()
    here_dir = os.path.dirname(os.path.abspath(__file__))
    proj_dir = testDataPath + "/TGTest"

    pkg_resources.working_set.add_entry(proj_dir)
    app = loadapp("config:development.ini", relative_to=proj_dir)
    app = TestApp(app)