def test_get_page_object_code_file_not_exist(self, project_session): testdir = project_session.testdir project = project_session.name page_path = os.path.join(project_session.path, 'pages', 'does', 'not', 'exist54654.py') code = page_object.get_page_object_code(page_path) assert code == ''
def test_get_page_object_code_file_not_exist(self, project_session): testdir = project_session['testdir'] project = project_session['name'] page_path = os.path.join(testdir, 'projects', project, 'pages', 'does', 'not', 'exist54654.py') code = page_object.get_page_object_code(page_path) assert code == ''
def test_get_page_object_code_file_not_exist(self, permanent_project_fixture): project = permanent_project_fixture['name'] testdir = permanent_project_fixture['testdir'] page_path = os.path.join(testdir, 'projects', project, 'pages', 'does', 'not', 'exist54654.py') code = page_object.get_page_object_code(page_path) assert code == ''
def page_code_view(project, full_page_name, no_sidebar=False): page_exists_ = page_object.page_exists(project, full_page_name) if not page_exists_: abort(404, 'The page {} does not exist'.format(full_page_name)) path = page_object.page_file_path(project, full_page_name) _, error = utils.import_module(path) page_object_code = page_object.get_page_object_code(path) return render_template('page_builder/page_object_code.html', project=project, page_object_code=page_object_code, page_name=full_page_name, error=error, no_sidebar=no_sidebar)
def test_get_page_object_code(self, project_session): _, project = project_session.activate() page_name = 'page_test_get_code_ab8456' page_object.new_page_object(project, [], page_name) page_path = os.path.join(project_session.path, 'pages', page_name + '.py') file_content = 'test=("id", "xyz")\ntest2=("id", "abc")\n' with open(page_path, 'w') as page_file: page_file.write(file_content) code = page_object.get_page_object_code(page_path) assert code == file_content
def test_get_page_object_code(self, permanent_project_fixture): project = permanent_project_fixture['name'] testdir = permanent_project_fixture['testdir'] page_name = 'page_test_get_code_ab8456' page_object.new_page_object(testdir, project, [], page_name) page_path = os.path.join(testdir, 'projects', project, 'pages', page_name + '.py') file_content = 'test=("id", "xyz")\ntest2=("id", "abc")\n' with open(page_path, 'w') as page_file: page_file.write(file_content) code = page_object.get_page_object_code(page_path) assert code == file_content
def page_code_view(project, full_page_name, no_sidebar=False): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') path = page_object.generate_page_path(root_path, project, full_page_name) error = utils.validate_python_file_syntax(path) page_object_code = page_object.get_page_object_code(path) return render_template('page_builder/page_object_code.html', project=project, page_object_code=page_object_code, page_name=full_page_name, error=error, no_sidebar=no_sidebar)
def page_code_view(project, full_page_name, no_sidebar=False): if not user.has_permissions_to_project(g.user.id, project, root_path, 'gui'): return render_template('not_permission.html') path = page_object.generate_page_path(root_path, project, full_page_name) error = utils.validate_python_file_syntax(path) page_object_code = page_object.get_page_object_code(path) return render_template('page_builder/page_object_code.html', project=project, page_object_code=page_object_code, page_name=full_page_name, error=error, no_sidebar=no_sidebar)
def test_get_page_object_code_file_not_exist(self, project_session): project_session.activate() page_path = os.path.join(project_session.path, 'pages', 'does', 'not', 'exist54654.py') code = page_object.get_page_object_code(page_path) assert code == ''