示例#1
0
def createproject_command(project):
    if test_directory.project_exists(project):
        msg = ('golem createproject: error: a project with name \'{}\' already exists'
               .format(project))
        sys.exit(msg)
    else:
        create_project(project)
示例#2
0
def project_create():
    project_name = request.json['project']
    project_name = project_name.strip().replace(' ', '_')
    _verify_permissions(Permissions.SUPER_USER)
    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 test_directory.project_exists(project_name):
        errors.append('A project with that name already exists')
    else:
        create_project(project_name)
        # update projects cache
        gui_utils.ProjectsCache.add(project_name)
    return jsonify({'errors': errors, 'project_name': project_name})
示例#3
0
 def test_create_project(self, testdir_session, test_utils):
     testdir_session.activate()
     project_name = test_utils.random_string()
     create_project(project_name)
     path = Project(project_name).path
     listdir = os.listdir(path)
     files = [n for n in listdir if os.path.isfile(os.path.join(path, n))]
     dirs = [n for n in listdir if os.path.isdir(os.path.join(path, n))]
     if '.DS_Store' in files:
         files.remove('.DS_Store')
     assert len(files) == 5
     # verify files
     assert '__init__.py' in files
     assert 'extend.py' in files
     assert 'environments.json' in files
     assert 'settings.json' in files
     assert 'secrets.json' in files
     # verify directories
     assert len(dirs) == 4
     # verify the test dir contains the correct directories
     assert 'pages' in dirs
     assert 'reports' in dirs
     assert 'tests' in dirs
     assert 'suites' in dirs
示例#4
0
 def test_project_exists(self, testdir_session, test_utils):
     testdir_session.activate()
     project = test_utils.random_string(10)
     assert not test_directory.project_exists(project)
     create_project(project)
     assert test_directory.project_exists(project)
示例#5
0
 def test_get_projects(self, testdir_function):
     testdir_function.activate()
     create_project('project1')
     create_project('project2')
     projects = test_directory.get_projects()
     assert projects.sort() == ['project1', 'project2'].sort()
示例#6
0
def createproject_command(project):
    if test_directory.project_exists(project):
        m = f'golem createproject: error: a project with name \'{project}\' already exists'
        sys.exit(m)
    else:
        create_project(project)