diff --git a/errors.txt b/errors.txt deleted file mode 100644 index e69de29..0000000 diff --git a/pyproject.toml b/pyproject.toml index 2d7ffdd..64107ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms-cloud" -version = "0.0.8" +version = "0.1.0" description = "Swarms Cloud - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms_cloud/__init__.py b/swarms_cloud/__init__.py index 588c44e..f6260b6 100644 --- a/swarms_cloud/__init__.py +++ b/swarms_cloud/__init__.py @@ -1,11 +1,9 @@ from swarms_cloud.api_key_generator import generate_api_key from swarms_cloud.func_api_wrapper import SwarmCloud -from swarms_cloud.main import agent_api_wrapper from swarms_cloud.rate_limiter import rate_limiter from swarms_cloud.sky_api import SkyInterface __all__ = [ - "agent_api_wrapper", "rate_limiter", "SwarmCloud", "generate_api_key", diff --git a/tests/test_api_generator.py b/tests/test_api_generator.py index da561a3..00cb94d 100644 --- a/tests/test_api_generator.py +++ b/tests/test_api_generator.py @@ -5,7 +5,6 @@ from swarms.structs.agent import Agent from swarms_cloud.api_key_generator import generate_api_key -from swarms_cloud.main import agent_api_wrapper # Basic tests @@ -115,95 +114,3 @@ def __init__(self, *args, **kwargs): def mock_method(self): self.method_called = True return "Hello World" - - -@pytest.mark.parametrize( - "http_method", - ["get", "post"], -) -def test_decorator_registers_endpoint(http_method): - # Arrange - app = FastAPI() - path = "/agent" - - # Act - @agent_api_wrapper(MockAgent, app, path, http_method=http_method) - def mock_method(): - return "Hello World" - - # Assert - if http_method == "get": - assert "GET" in app.routes - else: - assert "POST" in app.routes - - assert path in app.routes - - -def test_decorator_logs_correctly(): - # Arrange - app = FastAPI() - path = "/agent" - logger = MagicMock() - - # Act - @agent_api_wrapper(MockAgent, app, path, logging=True) - def mock_method(): - return "Hello World" - - # Assert - assert logger.info.call_count == 3 - assert logger.error.call_count == 0 - - -def test_endpoint_wrapper_calls_agent_method(): - # Arrange - app = FastAPI() - path = "/agent" - agent_instance = MockAgent() - - # Act - @agent_api_wrapper(MockAgent, app, path) - def mock_method(): - return "Hello World" - - # Assert - assert agent_instance.mock_method.called - - -def test_endpoint_wrapper_returns_result(): - # Arrange - app = FastAPI() - path = "/agent" - MockAgent() - expected_result = "Hello World" - - # Act - @agent_api_wrapper(MockAgent, app, path) - def mock_method(): - return expected_result - - # Assert - response = app.get(path) - assert response.status_code == 200 - assert response.json() == expected_result - - -def test_endpoint_wrapper_raises_exception(): - # Arrange - app = FastAPI() - path = "/agent" - MockAgent() - expected_error = Exception("Test error") - - # Act - @agent_api_wrapper(MockAgent, app, path) - def mock_method(): - raise expected_error - - # Assert - with pytest.raises(HTTPException) as error: - app.get(path) - - assert error.value.status_code == 500 - assert error.value.detail == str(expected_error)