Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-core: fix buggy (false positive) connection unit test #841

Merged
merged 3 commits into from
May 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_router_open_connection():
router, mock_conn, _ = managed_connection_router()

conn = router.open_connection("TEST_DB")
assert mock_conn == conn.connect()
assert conn is conn.connect()


def test_router_raw_connection():
Expand All @@ -45,7 +45,9 @@ def test_router_raw_connection():
router.add_open_connection_factory_method("RAW_DB", lambda: mock_conn)

conn = router.open_connection("RAW_DB")
assert mock_conn == conn.connect()
assert mock_conn is conn._connect()
assert conn is conn.connect()
assert mock_conn is not conn.connect()


def test_router_open_connection_closed():
Expand All @@ -54,7 +56,7 @@ def test_router_open_connection_closed():
conn = router.open_connection("TEST_DB")
conn.close()
conn = router.open_connection("TEST_DB")
assert mock_conn == conn.connect()
assert conn is conn.connect()


def test_router_no_such_connection():
Expand All @@ -68,11 +70,11 @@ def test_router_open_default_connection():
router, mock_conn, mock_conf = managed_connection_router()
mock_conf.get_value.return_value = "TEST_DB"
conn = router.open_default_connection()
assert mock_conn == conn.connect()
assert conn is conn.connect()


def test_router_open_default_connection_no_conf():
router, mock_conn, mock_conf = managed_connection_router()
mock_conf.get_value.return_value = None
conn = router.open_default_connection()
assert mock_conn == conn.connect()
assert conn is conn.connect()