-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
9 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
from typing import Any, Dict | ||
|
||
from infrahub.core import registry | ||
from infrahub.core.schema import SchemaRoot | ||
from infrahub.database import InfrahubDatabase | ||
from tests.helpers.schema import load_schema | ||
|
||
|
||
async def load_schema(db: InfrahubDatabase, schema: Dict[str, Any]): | ||
default_branch_name = registry.default_branch | ||
branch_schema = registry.schema.get_schema_branch(name=default_branch_name) | ||
tmp_schema = branch_schema.duplicate() | ||
tmp_schema.load_schema(schema=SchemaRoot(**schema)) | ||
tmp_schema.process() | ||
|
||
await registry.schema.update_schema_branch(schema=tmp_schema, db=db, branch=default_branch_name, update_db=True) | ||
async def load_schema_(db: InfrahubDatabase, schema: Dict[str, Any]): | ||
await load_schema(db=db, schema=SchemaRoot(**schema), update_db=True) |