def test_rename_page(data): page_name = project.create_random_page(data.project) new_page_name = actions.random_str() response = page.rename_page(data.project, page_name, new_page_name) assert response.status_code == 200 assert response.json()['errors'] == [] assert not project.page_exists(data.project, page_name) assert project.page_exists(data.project, new_page_name)
def test_rename_page_directory(data): # rename page new_dir = actions.random_str() response = page.rename_page_directory(data.project, data.dir, new_dir) assert response.status_code == 200 assert response.json()['errors'] == [] # old page does not exist anymore assert not project.page_exists(data.project, data.page_full) # new page exists new_page_full = '{}.{}'.format(new_dir, data.page_name) assert project.page_exists(data.project, new_page_full)
def test_rename_page_does_not_exist(data): page_name = actions.random_str() new_page_name = actions.random_str() response = page.rename_page(data.project, page_name, new_page_name) assert response.status_code == 200 assert response.json()['errors'] == [ 'Page {} does not exist'.format(page_name) ] assert not project.page_exists(data.project, new_page_name)
def test_rename_page_as_standard_user(data): page_name = project.create_random_page(data.project) new_page_name = actions.random_str() standard = user_factory.create_user_if('general__standard') response = page.rename_page(data.project, page_name, new_page_name, user=standard) assert response.status_code == 200 assert project.page_exists(data.project, new_page_name)
def test_duplicate_page_as_standard_user(data): new_page_name = actions.random_str() standard = user_factory.create_user_if('general__standard') response = page.duplicate_page(data.project, data.page, new_page_name, user=standard) assert response.status_code == 200 assert response.json() == [] assert project.page_exists(data.project, new_page_name)
def test_create_page(data): page = actions.random_str() response = project.create_page(data.project, page) assert response.status_code == 200 assert response.json()['errors'] == [] assert project.page_exists(data.project, page)
def test_delete_page(data): page_name = project.create_random_page(data.project) response = page.delete_page(data.project, page_name) assert response.status_code == 200 assert response.json() == [] assert not project.page_exists(data.project, page_name)
def test_duplicate_page(data): new_page_name = actions.random_str() response = page.duplicate_page(data.project, data.page, new_page_name) assert response.status_code == 200 assert response.json() == [] assert project.page_exists(data.project, new_page_name)