def test_generate_report_with_env(self, project_session):
    (_, project) = project_session.activate()
    timestamp = utils.get_timestamp()
    test_name = 'testing_report_003'
    suite_name = 'suite_foo_003'
    exec_dir = create_execution_directory(project, suite_name, timestamp)
    report_dir = create_report_directory(exec_dir, test_name, is_suite=True)
    test_data = {'env': {'name': 'env01', 'url': '1.1.1.1'}, 'var2': 'value2'}
    test_data = test_runner.Data(test_data)
    result = {'result': 'success', 'errors': [], 'description': 'description of the test', 'steps': [{'message': 'step1', 'screenshot': None, 'error': None}, {'message': 'step2', 'screenshot': None, 'error': None}], 'test_elapsed_time': 22.22, 'test_timestamp': '2018.02.04.02.16.42.729', 'browser': 'chrome', 'browser_full_name': '', 'set_name': 'set_001'}
    generate_report(report_dir, test_name, test_data, result)
    path = os.path.join(report_dir, 'report.json')
    with open(path) as report_file:
        actual = json.load(report_file)
        assert (len(actual.items()) == 11)
        assert (actual['test_case'] == test_name)
        assert (actual['result'] == 'success')
        assert (actual['steps'][0]['message'] == 'step1')
        assert (actual['steps'][1]['message'] == 'step2')
        assert (actual['description'] == 'description of the test')
        assert (actual['errors'] == [])
        assert (actual['test_elapsed_time'] == 22.22)
        assert (actual['test_timestamp'] == '2018.02.04.02.16.42.729')
        assert (actual['browser'] == 'chrome')
        assert (actual['environment'] == 'env01')
        assert (actual['set_name'] == 'set_001')
        test_data_a = "{'url': '1.1.1.1', 'name': 'env01'}"
        test_data_b = "{'name': 'env01', 'url': '1.1.1.1'}"
        assert (actual['test_data']['env'] in [test_data_a, test_data_b])
        assert (actual['test_data']['var2'] == "'value2'")
def test_generate_report_with_env(self, project_session):
    (_, project) = project_session.activate()
    timestamp = utils.get_timestamp()
    test_name = 'testing_report_003'
    suite_name = 'suite_foo_003'
    exec_dir = create_execution_directory(project, suite_name, timestamp)
    report_dir = create_report_directory(exec_dir, test_name, is_suite=True)
    test_data = {'env': {'name': 'env01', 'url': '1.1.1.1'}, 'var2': 'value2'}
    test_data = test_runner.Data(test_data)
    result = {'result': 'success', 'errors': [], 'description': 'description of the test', 'steps': [{'message': 'step1', 'screenshot': None, 'error': None}, {'message': 'step2', 'screenshot': None, 'error': None}], 'test_elapsed_time': 22.22, 'test_timestamp': '2018.02.04.02.16.42.729', 'browser': 'chrome', 'browser_full_name': , 'set_name': 'set_001'}
    generate_report(report_dir, test_name, test_data, result)
    path = os.path.join(report_dir, 'report.json')
    with open(path) as report_file:
        actual = json.load(report_file)
        assert (len(actual.items()) == 11)
        assert (actual['test_case'] == test_name)
        assert (actual['result'] == 'success')
        assert (actual['steps'][0]['message'] == 'step1')
        assert (actual['steps'][1]['message'] == 'step2')
        assert (actual['description'] == 'description of the test')
        assert (actual['errors'] == [])
        assert (actual['test_elapsed_time'] == 22.22)
        assert (actual['test_timestamp'] == '2018.02.04.02.16.42.729')
        assert (actual['browser'] == 'chrome')
        assert (actual['environment'] == 'env01')
        assert (actual['set_name'] == 'set_001')
        test_data_a = "{'url': '1.1.1.1', 'name': 'env01'}"
        test_data_b = "{'name': 'env01', 'url': '1.1.1.1'}"
        assert (actual['test_data']['env'] in [test_data_a, test_data_b])
        assert (actual['test_data']['var2'] == "'value2'")