fix: failing tests
This commit is contained in:
parent
dc64dd5ffa
commit
4d1cf5393c
4 changed files with 17 additions and 9 deletions
|
|
@ -174,8 +174,8 @@ jobs:
|
||||||
cd dist
|
cd dist
|
||||||
pip install *.whl
|
pip install *.whl
|
||||||
|
|
||||||
run-soft-deletion-test:
|
run-deletion-on-default-graph-test:
|
||||||
name: Soft Delete test ${{ matrix.python-version }} on ${{ matrix.os }}
|
name: Delete default graph data test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -193,7 +193,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Run Soft Deletion Tests
|
- name: Run Deletion on Default Graph Tests
|
||||||
env:
|
env:
|
||||||
ENV: 'dev'
|
ENV: 'dev'
|
||||||
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia
|
||||||
|
|
@ -202,10 +202,10 @@ jobs:
|
||||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||||
run: uv run python ./cognee/tests/test_delete_soft.py
|
run: uv run python ./cognee/tests/test_delete_default_graph.py
|
||||||
|
|
||||||
run-hard-deletion-test:
|
run-deletion-on-custom-graph-test:
|
||||||
name: Hard Delete test ${{ matrix.python-version }} on ${{ matrix.os }}
|
name: Delete custom graph data test ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -232,4 +232,4 @@ jobs:
|
||||||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||||
run: uv run python ./cognee/tests/test_delete_hard.py
|
run: uv run python ./cognee/tests/test_delete_custom_graph.py
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from uuid import UUID
|
||||||
from typing import Union, BinaryIO, List, Optional
|
from typing import Union, BinaryIO, List, Optional
|
||||||
|
|
||||||
from cognee.modules.users.models import User
|
from cognee.modules.users.models import User
|
||||||
|
from cognee.modules.users.methods import get_default_user
|
||||||
from cognee.api.v1.add import add
|
from cognee.api.v1.add import add
|
||||||
from cognee.api.v1.cognify import cognify
|
from cognee.api.v1.cognify import cognify
|
||||||
from cognee.api.v1.datasets import datasets
|
from cognee.api.v1.datasets import datasets
|
||||||
|
|
@ -72,6 +73,9 @@ async def update(
|
||||||
- Processing status and any errors
|
- Processing status and any errors
|
||||||
- Execution timestamps and metadata
|
- Execution timestamps and metadata
|
||||||
"""
|
"""
|
||||||
|
if not user:
|
||||||
|
user = get_default_user()
|
||||||
|
|
||||||
await datasets.delete_data(
|
await datasets.delete_data(
|
||||||
dataset_id=dataset_id,
|
dataset_id=dataset_id,
|
||||||
data_id=data_id,
|
data_id=data_id,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import os
|
||||||
import cognee
|
import cognee
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
from cognee.modules.data.exceptions.exceptions import UnauthorizedDataAccessError
|
||||||
from cognee.modules.users.exceptions import PermissionDeniedError
|
from cognee.modules.users.exceptions import PermissionDeniedError
|
||||||
from cognee.shared.logging_utils import get_logger
|
from cognee.shared.logging_utils import get_logger
|
||||||
from cognee.modules.search.types import SearchType
|
from cognee.modules.search.types import SearchType
|
||||||
|
|
@ -193,10 +194,12 @@ async def main():
|
||||||
data_id=text_data_id,
|
data_id=text_data_id,
|
||||||
user_id=default_user.id,
|
user_id=default_user.id,
|
||||||
)
|
)
|
||||||
except PermissionDeniedError:
|
except UnauthorizedDataAccessError:
|
||||||
delete_error = True
|
delete_error = True
|
||||||
|
|
||||||
assert delete_error, "PermissionDeniedError was not raised during delete operation as expected"
|
assert delete_error, (
|
||||||
|
"UnauthorizedDataAccessError was not raised during delete operation as expected"
|
||||||
|
)
|
||||||
|
|
||||||
# Try deleting data from test_user dataset with test_user
|
# Try deleting data from test_user dataset with test_user
|
||||||
# Get the dataset data to find the ID of the first data item (text)
|
# Get the dataset data to find the ID of the first data item (text)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ from cognee.infrastructure.databases.graph import get_graph_engine
|
||||||
from cognee.low_level import setup, DataPoint
|
from cognee.low_level import setup, DataPoint
|
||||||
from cognee.modules.data.models import Dataset
|
from cognee.modules.data.models import Dataset
|
||||||
from cognee.modules.users.methods import get_default_user
|
from cognee.modules.users.methods import get_default_user
|
||||||
|
from cognee.modules.users.models import User
|
||||||
from cognee.pipelines import run_tasks, Task
|
from cognee.pipelines import run_tasks, Task
|
||||||
from cognee.tasks.storage import add_data_points
|
from cognee.tasks.storage import add_data_points
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue