示例#1
0
 def test_duplicate_test(self, project_function):
     _, project = project_function.activate()
     test_case.new_test_case(project, [], 'test1')
     data_path_data = os.path.join(project_function.path, 'data',
                                   'test1.csv')
     os.makedirs(os.path.dirname(data_path_data))
     open(data_path_data, 'x').close()
     data_path_tests = os.path.join(project_function.path, 'tests',
                                    'test1.csv')
     open(data_path_tests, 'x').close()
     errors = utils.duplicate_element(project, 'test', 'test1',
                                      'subdir.test2')
     assert errors == []
     path = os.path.join(project_function.path, 'tests', 'test1.py')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'tests', 'test1.csv')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'data', 'test1.csv')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'tests', 'subdir',
                         'test2.py')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'tests', 'subdir',
                         'test2.csv')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'data', 'subdir',
                         'test2.csv')
     assert os.path.isfile(path)
示例#2
0
 def test_duplicate_same_file(self, project_function):
     testdir = project_function.testdir
     project = project_function.name
     os.chdir(testdir)
     errors = utils.duplicate_element(testdir, project, 'suite', 'suite1',
                                      'suite1')
     assert errors == ['New file cannot be the same as the original']
示例#3
0
 def test_duplicate_destination_already_exists(self, project_function):
     testdir = project_function['testdir']
     project = project_function['name']
     os.chdir(testdir)
     suite.new_suite(testdir, project, [], 'suite1')
     suite.new_suite(testdir, project, [], 'suite2')
     errors = utils.duplicate_element(testdir, project, 'suite', 'suite1', 'suite2')
     assert errors == ['A file with that name already exists']
示例#4
0
def duplicate_element():
    if request.method == 'POST':
        project = request.form['project']
        elem_type = request.form['elemType']
        full_path = request.form['fullPath']
        new_file_full_path = request.form['newFileFullPath']
        errors = utils.duplicate_element(project, elem_type, full_path, new_file_full_path)
        return json.dumps(errors)
示例#5
0
 def test_duplicate_page_to_same_folder(self, project_function):
     _, project = project_function.activate()
     page_object.new_page_object(project, [], 'page1')
     errors = utils.duplicate_element(project, 'page', 'page1', 'page2')
     assert errors == []
     path = os.path.join(project_function.path, 'pages', 'page1.py')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'pages', 'page2.py')
     assert os.path.isfile(path)
示例#6
0
def duplicate_element():
    if request.method == 'POST':
        project = request.form['project']
        elem_type = request.form['elemType']
        full_path = request.form['fullPath']
        new_file_full_path = request.form['newFileFullPath']
        errors = utils.duplicate_element(root_path, project, elem_type,
                                         full_path, new_file_full_path)
        return json.dumps(errors)
示例#7
0
 def test_duplicate_suite(self, project_function):
     _, project = project_function.activate()
     suite.new_suite(project, [], 'suite1')
     errors = utils.duplicate_element(project, 'suite', 'suite1',
                                      'sub.suite2')
     assert errors == []
     path = os.path.join(project_function.path, 'suites', 'suite1.py')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'suites', 'sub',
                         'suite2.py')
     assert os.path.isfile(path)
示例#8
0
 def test_duplicate_suite(self, project_function):
     testdir = project_function['testdir']
     project = project_function['name']
     os.chdir(testdir)
     suite.new_suite(testdir, project, [], 'suite1')
     errors = utils.duplicate_element(testdir, project, 'suite', 'suite1', 'sub.suite2')
     assert errors == []
     path = os.path.join(testdir, 'projects', project, 'suites', 'suite1.py')
     assert os.path.isfile(path)
     path = os.path.join(testdir, 'projects', project, 'suites', 'sub', 'suite2.py')
     assert os.path.isfile(path)
示例#9
0
 def test_duplicate_page_to_same_folder(self, project_function):
     testdir = project_function['testdir']
     project = project_function['name']
     os.chdir(testdir)
     page_object.new_page_object(testdir, project, [], 'page1')
     errors = utils.duplicate_element(testdir, project, 'page', 'page1', 'page2')
     assert errors == []
     path = os.path.join(testdir, 'projects', project, 'pages', 'page1.py')
     assert os.path.isfile(path)
     path = os.path.join(testdir, 'projects', project, 'pages', 'page2.py')
     assert os.path.isfile(path)
示例#10
0
 def test_duplicate_page(self, project_function):
     testdir = project_function.testdir
     project = project_function.name
     os.chdir(testdir)
     page_object.new_page_object(testdir, project, [], 'page1')
     errors = utils.duplicate_element(testdir, project, 'page', 'page1',
                                      'sub.page2')
     assert errors == []
     path = os.path.join(project_function.path, 'pages', 'page1.py')
     assert os.path.isfile(path)
     path = os.path.join(project_function.path, 'pages', 'sub', 'page2.py')
     assert os.path.isfile(path)
示例#11
0
 def test_duplicate_destination_already_exists(self, project_function):
     _, project = project_function.activate()
     suite.new_suite(project, [], 'suite1')
     suite.new_suite(project, [], 'suite2')
     errors = utils.duplicate_element(project, 'suite', 'suite1', 'suite2')
     assert errors == ['A file with that name already exists']
示例#12
0
 def test_duplicate_same_file(self, project_function):
     _, project = project_function.activate()
     errors = utils.duplicate_element(project, 'suite', 'suite1', 'suite1')
     assert errors == ['New file cannot be the same as the original']