Ejemplo n.º 1
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)
Ejemplo n.º 2
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
    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)
Ejemplo n.º 4
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)