Ejemplo n.º 1
0
def setup(data):
    project.using_project('general')
    actions.store('dir_one', actions.random_str())
    actions.store('dir_two', '{}.{}'.format(actions.random_str(),
                                            actions.random_str()))
    project.create_test_directory(data.project, data.dir_one)
    project.create_test_directory(data.project, data.dir_two)
Ejemplo n.º 2
0
def setup(data):
    project.using_project('general')
    actions.store('dir', actions.random_str())
    actions.store('test_name', actions.random_str())
    actions.store('test', '{}.{}'.format(data.dir, data.test_name))
    project.create_test_directory(data.project, data.dir)
    project.create_test(data.project, data.test)
Ejemplo n.º 3
0
def test_rename_test_directory_to_same_name(data):
    dir_one = actions.random_str()
    project.create_test_directory(data.project, dir_one)
    response = test_.rename_test_directory(data.project, dir_one, dir_one)
    assert response.json()['errors'] == [
        'Path {} already exists'.format(dir_one)
    ]
Ejemplo n.º 4
0
def test(data):
    response = project.create_test_directory(data.project, data.dir_one)
    assert response.json()['errors'] == [
        'A directory with that name already exists'
    ]
    response = project.create_test_directory(data.project, data.dir_two)
    assert response.json()['errors'] == [
        'A directory with that name already exists'
    ]
Ejemplo n.º 5
0
def test_rename_test_directory_destination_exists(data):
    dir_one = actions.random_str()
    dir_two = actions.random_str()
    project.create_test_directory(data.project, dir_one)
    project.create_test_directory(data.project, dir_two)
    response = test_.rename_test_directory(data.project, dir_one, dir_two)
    assert response.json()['errors'] == [
        'Path {} already exists'.format(dir_two)
    ]
Ejemplo n.º 6
0
def test_rename_test_directory_to_parent(data):
    dirname = actions.random_str()
    subdir = '{}.{}'.format(dirname, actions.random_str())
    project.create_test_directory(data.project, dirname)
    project.create_test_directory(data.project, subdir)

    response = test_.rename_test_directory(data.project, subdir, dirname)
    assert response.json()['errors'] == [
        'Path {} already exists'.format(dirname)
    ]
Ejemplo n.º 7
0
def test_rename_test_directory(data):
    # rename a test directory with a test inside
    dirname = actions.random_str()
    test_name = actions.random_str()
    test_path = '{}.{}'.format(dirname, test_name)
    project.create_test_directory(data.project, dirname)
    project.create_test(data.project, test_path)

    new_dir = actions.random_str()
    response = test_.rename_test_directory(data.project, dirname, new_dir)
    assert response.status_code == 200
    assert response.json()['errors'] == []
    assert not project.test_exists(data.project, test_path)
    new_test_path = '{}.{}'.format(new_dir, test_name)
    assert project.test_exists(data.project, new_test_path)
Ejemplo n.º 8
0
def test_create_test_directory_exists(data):
    dir_one = actions.random_str()
    dir_two = '{}.{}'.format(actions.random_str(), actions.random_str())
    project.create_test_directory(data.project, dir_one)
    project.create_test_directory(data.project, dir_two)
    response = project.create_test_directory(data.project, dir_one)
    assert response.json()['errors'] == [
        'A directory with that name already exists'
    ]
    response = project.create_test_directory(data.project, dir_two)
    assert response.json()['errors'] == [
        'A directory with that name already exists'
    ]
Ejemplo n.º 9
0
def test_delete_test_directory(data):
    dirname = actions.random_str()
    project.create_test_directory(data.project, dirname)
    response = test_.delete_test_directory(data.project, dirname)
    assert response.status_code == 200
    assert response.json()['errors'] == []
Ejemplo n.º 10
0
def test_create_test_directory(data):
    response = project.create_test_directory(data.project,
                                             actions.random_str())
    assert response.status_code == 200
    assert response.json()['errors'] == []
Ejemplo n.º 11
0
def test_create_test_directory_with_invalid_name(data):
    dir_name = 'test-{}'.format(actions.random_str())
    response = project.create_test_directory(data.project, dir_name)
    assert response.json()['errors'] == [
        'Only letters, numbers and underscores are allowed'
    ]