Exemple #1
0
def test(data):
    new_page_name = actions.random_str()
    response = page.duplicate_page(data.project,
                                   data.page,
                                   new_page_name,
                                   user=data.user)
    assert response.status_code == 401
Exemple #2
0
def test(data):
    new_name = 'invalid-{}'.format(actions.random_str())
    response = page.duplicate_page(data.project, data.page, new_name)
    assert response.json() == [
        'Only letters, numbers and underscores are allowed'
    ]
    assert project.get_page_exists(data.project, data.page).json()
    assert not project.get_page_exists(data.project, new_name).json()
def test_duplicate_page_as_read_only_user(data):
    new_page_name = actions.random_str()
    read_only = user_factory.create_user_if('general__read-only')
    response = page.duplicate_page(data.project,
                                   data.page,
                                   new_page_name,
                                   user=read_only)
    assert response.status_code == 401
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)
Exemple #5
0
def test(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.get_page_exists(data.project, new_page_name).json()
def test(data):
    response = page.duplicate_page(data.project, data.page_one, data.page_two)
    assert response.status_code == 200
    assert response.json() == ['A page with that name already exists']
def test_duplicate_page_destination_exists(data):
    new_page = project.create_random_page(data.project)
    response = page.duplicate_page(data.project, data.page, new_page)
    assert response.status_code == 200
    assert response.json() == ['A page with that name already exists']
def test_duplicate_page_does_not_exist(data):
    does_not_exist = actions.random_str()
    new_page_name = actions.random_str()
    response = page.duplicate_page(data.project, does_not_exist, new_page_name)
    assert response.status_code == 200
    assert response.json() == ['Page {} does not exist'.format(does_not_exist)]