Skip to content

Commit

Permalink
vdk-csv: uncomment test (#2704)
Browse files Browse the repository at this point in the history
Addressing: #2677
  • Loading branch information
duyguHsnHsn authored Sep 26, 2023
1 parent 67817f5 commit d12b83e
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions projects/vdk-plugins/vdk-csv/tests/functional/test_csv_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from unittest import mock

from click.testing import Result
from vdk.internal.core.errors import ResolvableByActual
from vdk.internal.core.errors import UserCodeError
from vdk.plugin.csv import csv_plugin
from vdk.plugin.sqlite import sqlite_plugin
Expand Down Expand Up @@ -150,32 +151,32 @@ def test_export_csv_with_already_existing_file(tmpdir):
cli_assert_equal(1, result)


# def test_csv_export_with_nonexistent_table(tmpdir):
# db_dir = str(tmpdir) + "vdk-sqlite.db"
# with mock.patch.dict(
# os.environ,
# {
# "VDK_DB_DEFAULT_TYPE": "SQLITE",
# "VDK_SQLITE_FILE": db_dir,
# },
# ):
# runner = CliEntryBasedTestRunner(sqlite_plugin, csv_plugin)
# drop_table(runner, "test_table")
# result = runner.invoke(
# [
# "export-csv",
# "--query",
# "SELECT * FROM test_table",
# "--file",
# "result3.csv",
# ]
# )
# assert isinstance(result.exception, OperationalError)
# assert hasattr(result.exception, "_vdk_resolvable_actual")
# assert (
# getattr(result.exception, "_vdk_resolvable_actual")
# == ResolvableByActual.PLATFORM
# )
def test_csv_export_with_nonexistent_table(tmpdir):
db_dir = str(tmpdir) + "vdk-sqlite.db"
with mock.patch.dict(
os.environ,
{
"VDK_DB_DEFAULT_TYPE": "SQLITE",
"VDK_SQLITE_FILE": db_dir,
},
):
runner = CliEntryBasedTestRunner(sqlite_plugin, csv_plugin)
drop_table(runner, "test_table")
result = runner.invoke(
[
"export-csv",
"--query",
"SELECT * FROM test_table",
"--file",
"result3.csv",
]
)
assert isinstance(result.exception, OperationalError)
assert hasattr(result.exception, "_vdk_resolvable_actual")
assert (
getattr(result.exception, "_vdk_resolvable_actual")
== ResolvableByActual.PLATFORM
)


def test_csv_export_with_no_data(tmpdir):
Expand Down

0 comments on commit d12b83e

Please sign in to comment.