Skip to content

Commit

Permalink
chore(deps): Bump galileo-core to v0.13.0 to add project helpers (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
setu4993 authored May 6, 2024
1 parent 1122205 commit 8189de3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 37 deletions.
60 changes: 30 additions & 30 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages = [{include = "galileo_protect", from = "src"}]

[tool.poetry.dependencies]
python = "^3.8.1,<3.13"
galileo-core = "^0.12.0"
galileo-core = "^0.13.0"


[tool.poetry.group.test.dependencies]
Expand Down
2 changes: 2 additions & 0 deletions src/galileo_protect/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# flake8: noqa: F401
# ruff: noqa: F401
from galileo_core.helpers.project import get_project, get_project_from_name

from galileo_protect.invoke import ainvoke, invoke
from galileo_protect.project import create_project
from galileo_protect.schemas import (
Expand Down
15 changes: 9 additions & 6 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
from uuid import uuid4

from galileo_core.constants.routes import Routes as CoreRoutes
from galileo_core.schemas.core.project import DEFAULT_PROJECT_NAME, ProjectType
from requests_mock import POST
from galileo_core.schemas.core.project import ProjectType
from requests_mock import GET, POST

from galileo_protect.project import create_project


def test_create_project(set_validated_config: Callable, mock_request: Callable) -> None:
config = set_validated_config()
project_name = "foo-bar"
project_id = uuid4()
matcher = mock_request(
matcher_get = mock_request(GET, CoreRoutes.projects + f"?project_name={project_name}", json=[])
matcher_post = mock_request(
POST,
CoreRoutes.projects,
json={"id": str(project_id), "type": ProjectType.protect, "name": DEFAULT_PROJECT_NAME},
json={"id": str(project_id), "type": ProjectType.protect, "name": project_name},
)
create_project(config=config)
assert matcher.called
create_project(name=project_name, config=config)
assert matcher_get.called
assert matcher_post.called
# Verify that the project ID was set in the config.
assert config.project_id is not None
assert config.project_id == project_id

0 comments on commit 8189de3

Please sign in to comment.