-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix integration and unit tests (#912)
* WIP * WIP * wip * Conftest revert * Add default database for testing * TLK-2723 Resolve current integration/unit test issues * TLK-2723 Resolve current integration/unit test issues * TLK-2723 Resolve current integration/unit test issues --------- Co-authored-by: EugeneP <[email protected]>
- Loading branch information
1 parent
b6381f5
commit d966233
Showing
27 changed files
with
115 additions
and
48 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
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
25 changes: 0 additions & 25 deletions
25
src/backend/database_models/seeders/deployments_models_seed.py
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from sqlalchemy import text | ||
from sqlalchemy.orm import Session | ||
|
||
from backend.database_models import Organization | ||
|
||
|
||
def seed_default_organization(op): | ||
""" | ||
Seed default organization. | ||
""" | ||
# Previously we would seed the default deployments and models here. We've changed this | ||
# behaviour during a refactor of the deployments module so that deployments and models | ||
# are inserted when they're first used. This solves an issue where seed data would | ||
# sometimes be inserted with invalid config data. | ||
|
||
_ = Session(op.get_bind()) | ||
|
||
# Seed default organization | ||
sql_command = text( | ||
""" | ||
INSERT INTO organizations ( | ||
id, name, created_at, updated_at | ||
) | ||
VALUES ( | ||
:id, :name, now(), now() | ||
) | ||
ON CONFLICT (id) DO NOTHING; | ||
""" | ||
).bindparams( | ||
id="default", | ||
name="Default Organization", | ||
) | ||
op.execute(sql_command) | ||
|
||
|
||
def delete_default_organization(op): | ||
""" | ||
Delete default organization. | ||
""" | ||
session = Session(op.get_bind()) | ||
session.query(Organization).filter_by(id="default").delete() | ||
session.commit() |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[pytest] | ||
env = | ||
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres | ||
DATABASE_URL=postgresql://postgres:postgres@localhost:5433 | ||
filterwarnings = | ||
ignore::UserWarning:pydantic.* | ||
ignore::DeprecationWarning |
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
Empty file.
Empty file.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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