def test_file_exporter_path_not_exist(patch_exists, path_isdir, makedirs):
    exporter = FileExporter('output_folder')

    dashboard_data = {'some_key': 'some_value'}
    with pytest.raises(Exception) as e:
        exporter.process_dashboard('project_name', 'dashboard_name', dashboard_data)
    assert 'testing' in str(e.value)
def test_file_exporter_path_not_exist(patch_exists, path_isdir, makedirs):
    exporter = FileExporter('output_folder')

    dashboard_data = {'some_key': 'some_value'}
    with pytest.raises(Exception) as e:
        exporter.process_dashboard('project_name', 'dashboard_name', dashboard_data)
    assert 'testing' in str(e.value)
def test_file_exporter(patch_exists, path_isdir, makedirs, json_dump, mock_file):
    exporter = FileExporter('output_folder')

    dashboard_data = {'some_key': 'some_value'}
    exporter.process_dashboard('project_name', 'dashboard_name', dashboard_data)

    json_dump.verify_called_once_with(dashboard_data, mock_file, sort_keys=True, indent=2, separators=(',', ': '))
def test_file_exporter(patch_exists, path_isdir, makedirs, json_dump, mock_file):
    exporter = FileExporter('output_folder')

    dashboard_data = {'some_key': 'some_value'}
    exporter.process_dashboard('project_name', 'dashboard_name', dashboard_data)

    json_dump.assert_called_once_with(dashboard_data, mock_file().__enter__(), sort_keys=True, indent=2,
                                      separators=(',', ': '))
Esempio n. 5
0
def test_file_exporter_output_not_dir(patch_exists, path_isdir, makedirs):
    with pytest.raises(Exception) as e:
        FileExporter('output_folder')

    assert "'output_folder' must be a directory" in str(e.value)