mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
test: migrate data source controller tests to testcontainers (#34292)
This commit is contained in:
parent
a1513f06c3
commit
dede190be2
@ -1,3 +1,7 @@
|
|||||||
|
"""Testcontainers integration tests for controllers.console.datasets.data_source endpoints."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from unittest.mock import MagicMock, PropertyMock, patch
|
from unittest.mock import MagicMock, PropertyMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -46,6 +50,10 @@ def mock_engine():
|
|||||||
|
|
||||||
|
|
||||||
class TestDataSourceApi:
|
class TestDataSourceApi:
|
||||||
|
@pytest.fixture
|
||||||
|
def app(self, flask_app_with_containers):
|
||||||
|
return flask_app_with_containers
|
||||||
|
|
||||||
def test_get_success(self, app, patch_tenant):
|
def test_get_success(self, app, patch_tenant):
|
||||||
api = DataSourceApi()
|
api = DataSourceApi()
|
||||||
method = unwrap(api.get)
|
method = unwrap(api.get)
|
||||||
@ -179,6 +187,10 @@ class TestDataSourceApi:
|
|||||||
|
|
||||||
|
|
||||||
class TestDataSourceNotionListApi:
|
class TestDataSourceNotionListApi:
|
||||||
|
@pytest.fixture
|
||||||
|
def app(self, flask_app_with_containers):
|
||||||
|
return flask_app_with_containers
|
||||||
|
|
||||||
def test_get_credential_not_found(self, app, patch_tenant):
|
def test_get_credential_not_found(self, app, patch_tenant):
|
||||||
api = DataSourceNotionListApi()
|
api = DataSourceNotionListApi()
|
||||||
method = unwrap(api.get)
|
method = unwrap(api.get)
|
||||||
@ -310,6 +322,10 @@ class TestDataSourceNotionListApi:
|
|||||||
|
|
||||||
|
|
||||||
class TestDataSourceNotionApi:
|
class TestDataSourceNotionApi:
|
||||||
|
@pytest.fixture
|
||||||
|
def app(self, flask_app_with_containers):
|
||||||
|
return flask_app_with_containers
|
||||||
|
|
||||||
def test_get_preview_success(self, app, patch_tenant):
|
def test_get_preview_success(self, app, patch_tenant):
|
||||||
api = DataSourceNotionApi()
|
api = DataSourceNotionApi()
|
||||||
method = unwrap(api.get)
|
method = unwrap(api.get)
|
||||||
@ -364,6 +380,10 @@ class TestDataSourceNotionApi:
|
|||||||
|
|
||||||
|
|
||||||
class TestDataSourceNotionDatasetSyncApi:
|
class TestDataSourceNotionDatasetSyncApi:
|
||||||
|
@pytest.fixture
|
||||||
|
def app(self, flask_app_with_containers):
|
||||||
|
return flask_app_with_containers
|
||||||
|
|
||||||
def test_get_success(self, app, patch_tenant):
|
def test_get_success(self, app, patch_tenant):
|
||||||
api = DataSourceNotionDatasetSyncApi()
|
api = DataSourceNotionDatasetSyncApi()
|
||||||
method = unwrap(api.get)
|
method = unwrap(api.get)
|
||||||
@ -403,6 +423,10 @@ class TestDataSourceNotionDatasetSyncApi:
|
|||||||
|
|
||||||
|
|
||||||
class TestDataSourceNotionDocumentSyncApi:
|
class TestDataSourceNotionDocumentSyncApi:
|
||||||
|
@pytest.fixture
|
||||||
|
def app(self, flask_app_with_containers):
|
||||||
|
return flask_app_with_containers
|
||||||
|
|
||||||
def test_get_success(self, app, patch_tenant):
|
def test_get_success(self, app, patch_tenant):
|
||||||
api = DataSourceNotionDocumentSyncApi()
|
api = DataSourceNotionDocumentSyncApi()
|
||||||
method = unwrap(api.get)
|
method = unwrap(api.get)
|
||||||
Loading…
Reference in New Issue
Block a user