def create_new_project(workspace, project): file_manager.create_directory(path_list=[workspace, 'projects', project], add_init=True) # TODO, remove, don't create data folder for new projects # create_directory(path_list=[workspace, 'projects', project, 'data'], add_init=False) path_list = [workspace, 'projects', project, 'pages'] file_manager.create_directory(path_list=path_list, add_init=True) path_list = [workspace, 'projects', project, 'reports'] file_manager.create_directory(path_list=path_list, add_init=False) path_list = [workspace, 'projects', project, 'tests'] file_manager.create_directory(path_list=path_list, add_init=True) path_list = [workspace, 'projects', project, 'suites'] file_manager.create_directory(path_list=path_list, add_init=True) extend_path = os.path.join(workspace, 'projects', project, 'extend.py') open(extend_path, 'a').close() settings_manager.create_project_settings_file(workspace, project) for project_base_file in ('environments.json', 'secrets.json'): base_file_path = os.path.join(workspace, 'projects', project, project_base_file) with open(base_file_path, 'a') as base_file: base_file.write('{}') print('Project {} created'.format(project))
def test_create_project_settings_file(self, project_class): _, project = project_class.activate() settings_path = os.path.join(project_class.path, 'settings.json') os.remove(settings_path) settings_manager.create_project_settings_file(project) with open(settings_path) as settings_file: actual = settings_file.read() assert actual == settings_manager.REDUCED_SETTINGS_FILE_CONTENT
def test_create_project_settings_file(self, project_class): testdir = project_class['testdir'] project = project_class['name'] settings_path = os.path.join(testdir, 'projects', project, 'settings.json') os.remove(settings_path) settings_manager.create_project_settings_file(testdir, project) with open(settings_path) as settings_file: actual = settings_file.read() assert actual == settings_manager.REDUCED_SETTINGS_FILE_CONTENT
def create_project(project_name): project = Project(project_name) file_manager.create_directory(path=project.path, add_init=True) file_manager.create_directory(path=project.test_directory_path, add_init=True) file_manager.create_directory(path=project.page_directory_path, add_init=True) file_manager.create_directory(path=project.suite_directory_path, add_init=True) file_manager.create_directory(path=project.report_directory_path, add_init=True) extend_path = os.path.join(project.path, 'extend.py') open(extend_path, 'a').close() settings_manager.create_project_settings_file(project_name) for project_base_file in ('environments.json', 'secrets.json'): base_file_path = os.path.join(project.path, project_base_file) with open(base_file_path, 'a') as base_file: base_file.write('{}') print('Project {} created'.format(project_name))
def create_new_project(project): testdir = session.testdir file_manager.create_directory(path_list=[testdir, 'projects', project], add_init=True) path_list = [testdir, 'projects', project, 'pages'] file_manager.create_directory(path_list=path_list, add_init=True) path_list = [testdir, 'projects', project, 'reports'] file_manager.create_directory(path_list=path_list, add_init=False) path_list = [testdir, 'projects', project, 'tests'] file_manager.create_directory(path_list=path_list, add_init=True) path_list = [testdir, 'projects', project, 'suites'] file_manager.create_directory(path_list=path_list, add_init=True) extend_path = os.path.join(testdir, 'projects', project, 'extend.py') open(extend_path, 'a').close() settings_manager.create_project_settings_file(project) for project_base_file in ('environments.json', 'secrets.json'): base_file_path = os.path.join(testdir, 'projects', project, project_base_file) with open(base_file_path, 'a') as base_file: base_file.write('{}') print('Project {} created'.format(project))
def test_create_project_settings_file(self, project_class): _, project = project_class.activate() os.remove(settings_manager.project_settings_path(project)) settings_manager.create_project_settings_file(project) with open(settings_manager.project_settings_path(project)) as f: assert f.read() == settings_manager.REDUCED_SETTINGS_FILE_CONTENT