def createproject_command(project): if utils.project_exists(project): msg = ( 'golem createproject: error: a project with name \'{}\' already exists' .format(project)) sys.exit(msg) else: utils.create_new_project(project)
def createproject_command(project): root_path = test_execution.root_path if project in utils.get_projects(root_path): msg = ('golem createproject: error: a project with name \'{}\' already exists' .format(project)) sys.exit(msg) else: utils.create_new_project(root_path, project)
def run(self, test_execution, args): root_path = test_execution.root_path if args.project in utils.get_projects(root_path): msg = 'Error: a project with the name \'{}\' already exists'.format( args.project) raise CommandException(msg) # elif args.project == 'demo': # utils.create_demo_project(root_path) else: utils.create_new_project(root_path, args.project)
def run(self, test_execution, args): root_path = test_execution.root_path if args.project in utils.get_projects(root_path): msg = 'Error: a project with the name \'{}\' already exists'.format( args.project ) raise CommandException(msg) # elif args.project == 'demo': # utils.create_demo_project(root_path) else: utils.create_new_project(root_path, args.project)
def new_project(): if request.method == 'POST': project_name = request.form['projectName'] project_name = project_name.strip().replace(' ', '_') errors = [] if len(project_name) < 3: errors.append('Project name is too short') elif len(project_name) > 50: errors.append('Project name is too long') elif utils.project_exists(project_name): errors.append('A project with that name already exists') else: utils.create_new_project(project_name) return json.dumps({'errors': errors, 'project_name': project_name})
def new_project(): if request.method == 'POST': project_name = request.form['projectName'] project_name = project_name.strip().replace(' ', '_') errors = [] if len(project_name) < 3: errors.append('Project name is too short') elif len(project_name) > 50: errors.append('Project name is too long') elif len(project_name) != len(project_name.strip()): errors.append('Leading and trailing spaces are not allowed') elif project_name in utils.get_projects(root_path): errors.append('A project with that name already exists') else: utils.create_new_project(root_path, project_name) return json.dumps({'errors': errors, 'project_name': project_name})
def test_get_projects(self, testdir_function): testdir_function.activate() utils.create_new_project('project1') utils.create_new_project('project2') projects = utils.get_projects() assert projects.sort() == ['project1', 'project2'].sort()
def test_get_projects(self, testdir_function): testdir = testdir_function.path utils.create_new_project(testdir, 'project1') utils.create_new_project(testdir, 'project2') projects = utils.get_projects(testdir) assert projects.sort() == ['project1', 'project2'].sort()