Пример #1
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)
def test(data):
    test_name = actions.random_str()
    response = project.get_test_exists(data.project, test_name)
    assert response.json() is False
    project.create_test(data.project, test_name)
    response = project.get_test_exists(data.project, test_name)
    assert response.json() is True
Пример #3
0
def test_rename_test_in_folder(data):
    test_two = '{}.{}'.format(actions.random_str(), actions.random_str())
    project.create_test(data.project, test_two)
    new_test_name_two = '{}.{}'.format(actions.random_str(),
                                       actions.random_str())
    response = test_.rename_test(data.project, test_two, new_test_name_two)
    assert response.json()['errors'] == []
    assert not project.test_exists(data.project, test_two)
    assert project.test_exists(data.project, new_test_name_two)
Пример #4
0
def test_delete_test(data):
    test_one = project.create_random_test(data.project)
    response = test_.delete_test(data.project, test_one)
    assert response.status_code == 200
    assert response.json() == []
    assert not project.test_exists(data.project, test_one)

    test_two = '{}.{}'.format(actions.random_str(), actions.random_str())
    project.create_test(data.project, test_two)
    test_.delete_test(data.project, test_two)
    assert not project.test_exists(data.project, test_two)
Пример #5
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)
Пример #6
0
def test(data):
    # to root
    test_one = actions.random_str()
    response = project.create_test(data.project, test_one)
    assert response.status_code == 200
    assert response.json()['errors'] == []
    # to folder
    test_two = '{}.{}'.format(actions.random_str(), actions.random_str())
    response = project.create_test(data.project, test_two)
    assert response.json()['errors'] == []
    # to sub folder
    test_three = '{}.{}.{}'.format(actions.random_str(), actions.random_str(),
                                   actions.random_str())
    response = project.create_test(data.project, test_three)
    assert response.json()['errors'] == []
Пример #7
0
def test_create_test_existing_name(data):
    test_name = project.create_random_test(data.project)
    response = project.create_test(data.project, test_name)
    assert response.status_code == 200
    assert response.json()['errors'] == [
        'A test with that name already exists'
    ]
def test(data):
    # to folder from root
    test_name = actions.random_str()
    full_name = '{}.{}'.format(actions.random_str(), test_name)
    response = project.create_test(data.project, full_name)
    assert response.status_code == 200
    assert response.json()['errors'] == []
    assert project.get_test_exists(data.project, full_name).json()
Пример #9
0
def test_create_test_with_invalid_name(data):
    # invalid chars
    response = project.create_test(data.project,
                                   'name-{}'.format(actions.random_str()))
    assert response.status_code == 200
    assert response.json()['errors'] == [
        'Only letters, numbers and underscores are allowed'
    ]
    # empty directory
    response = project.create_test(data.project, '.test_name')
    assert response.json()['errors'] == ['Directory name cannot be empty']
    # max length
    response = project.create_test(data.project, 'a' * 151)
    assert response.json()['errors'] == [
        'Maximum name length is 150 characters'
    ]
    # empty name
    response = project.create_test(data.project, '')
    assert response.json()['errors'] == ['File name cannot be empty']
Пример #10
0
def create_access_test(project_name, test_name):
    project_api.create_test(project_name, test_name)
    actions.get_browser().navigate(urls.test(project_name, test_name))
Пример #11
0
def setup(data):
    project.using_project('general')
    data.test_one = project.create_random_test(data.project)
    data.test_two = '{}.{}'.format(actions.random_str(), actions.random_str())
    project.create_test(data.project, data.test_two)
Пример #12
0
def test_create_test_as_read_only_user(data):
    read_only = user_factory.create_user_if('general__read-only')
    response = project.create_test(data.project,
                                   actions.random_str(),
                                   user=read_only)
    assert response.status_code == 401
Пример #13
0
def test_create_test_to_subfolder(data):
    test_name = '{}.{}.{}'.format(actions.random_str(), actions.random_str(),
                                  actions.random_str())
    response = project.create_test(data.project, test_name)
    assert response.json()['errors'] == []
    assert project.test_exists(data.project, test_name)
Пример #14
0
def test_create_test_to_test_root_folder(data):
    test_name = actions.random_str()
    response = project.create_test(data.project, test_name)
    assert response.status_code == 200
    assert response.json()['errors'] == []
    assert project.test_exists(data.project, test_name)
Пример #15
0
def test(data):
    response = project.create_test(data.project, data.test_one)
    assert response.status_code == 200
    assert response.json()['errors'] == [
        'A test with that name already exists'
    ]
Пример #16
0
def create_test(project_name, test_name):
    project_api.create_test(project_name, test_name)
Пример #17
0
def create_test(project_name, test_name=None):
    if test_name is None:
        test_name = actions.random_str()
    project_api.create_test(project_name, test_name)
    return test_name
Пример #18
0
def test(data):
    response = project.get_project_has_tests(data.project)
    assert not response.json()
    project.create_test(data.project, actions.random_str())
    response = project.get_project_has_tests(data.project)
    assert response.json()
Пример #19
0
def test(data):
    test_name = actions.random_str()
    response = project.create_test(data.project, test_name, user=data.user)
    assert response.status_code == 401
Пример #20
0
def test_delete_test_directory_with_a_test_inside(data):
    dir_two = actions.random_str()
    test = '{}.{}'.format(dir_two, actions.random_str())
    project.create_test(data.project, test)
    test_.delete_test_directory(data.project, dir_two)
    assert not project.test_exists(data.project, test)