-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor tests, use db migrations, correct session, rollback automati…
…cally (#12) * Refactor tests, use db migrations, correct session, rollback automatically * Remove unnecessary test * Remove unnecessary package * Fix rollback to be global * Remove unused functions and improve a test case * Return accidentally deleted test case * Bring back a couple of tests and fix one * Apply small review suggestions
- Loading branch information
Showing
8 changed files
with
125 additions
and
213 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,18 @@ | ||
from sqlalchemy.orm import Session | ||
from src.data_access.models import Artefact, Stage | ||
|
||
|
||
def create_artefact(db_session: Session, stage_name: str, **kwargs): | ||
"""Create a dummy artefact""" | ||
stage = db_session.query(Stage).filter(Stage.name == stage_name).first() | ||
artefact = Artefact( | ||
name=kwargs.get("name", ""), | ||
stage=stage, | ||
version=kwargs.get("version", "1.1.1"), | ||
source=kwargs.get("source", {}), | ||
artefact_group=None, | ||
is_archived=kwargs.get("is_archived", False), | ||
) | ||
db_session.add(artefact) | ||
db_session.commit() | ||
return artefact |
Oops, something went wrong.