-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First implementation of flow exists * Rename function and favor verbose usage This makes it more clear where the data is actually coming from. * Make return value depend on database response * Test database layer is called correctly * Add database level test * Separate out database tests * Separate out api vs function tests * Add happy path migration test * Add migration test for flow_exists * Only rollback the transaction if one is active * Add migration test for flow_exist but no match * Fix type issue * Add pytest-mock dependency
- Loading branch information
Showing
7 changed files
with
216 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ dependencies = [ | |
dev = [ | ||
"pre-commit", | ||
"pytest", | ||
"pytest-mock", | ||
"httpx", | ||
"hypothesis", | ||
"deepdiff", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import database.flows | ||
from sqlalchemy import Connection | ||
|
||
from tests.conftest import Flow | ||
|
||
|
||
def test_database_flow_exists(flow: Flow, expdb_test: Connection) -> None: | ||
retrieved_flow = database.flows.get_by_name(flow.name, flow.external_version, expdb_test) | ||
assert retrieved_flow is not None | ||
assert retrieved_flow.id == flow.id | ||
# when using actual ORM, can instead ensure _all_ fields match. | ||
|
||
|
||
def test_database_flow_exists_returns_none_if_no_match(expdb_test: Connection) -> None: | ||
retrieved_flow = database.flows.get_by_name( | ||
name="foo", | ||
external_version="bar", | ||
expdb=expdb_test, | ||
) | ||
assert retrieved_flow is None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters