mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
test: add agent test coverage and standardize test suite (#2051)
- Add 104 comprehensive tests for agent system - Integrate agent tests into CI/CD pipeline - Standardize tests with @pytest.mark.unit markers - Fix cross-platform path compatibility - Clean up unused imports and dependencies
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from flask import Flask
|
||||
from application.error import bad_request, response_error
|
||||
from flask import Flask
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -9,31 +9,35 @@ def app():
|
||||
return app
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_bad_request_with_message(app):
|
||||
with app.app_context():
|
||||
message = "Invalid input"
|
||||
response = bad_request(status_code=400, message=message)
|
||||
assert response.status_code == 400
|
||||
assert response.json == {'error': 'Bad Request', 'message': message}
|
||||
assert response.json == {"error": "Bad Request", "message": message}
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_bad_request_without_message(app):
|
||||
with app.app_context():
|
||||
response = bad_request(status_code=400)
|
||||
assert response.status_code == 400
|
||||
assert response.json == {'error': 'Bad Request'}
|
||||
assert response.json == {"error": "Bad Request"}
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_response_error_with_message(app):
|
||||
with app.app_context():
|
||||
message = "Something went wrong"
|
||||
response = response_error(code_status=500, message=message)
|
||||
assert response.status_code == 500
|
||||
assert response.json == {'error': 'Internal Server Error', 'message': message}
|
||||
assert response.json == {"error": "Internal Server Error", "message": message}
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_response_error_without_message(app):
|
||||
with app.app_context():
|
||||
response = response_error(code_status=500)
|
||||
assert response.status_code == 500
|
||||
assert response.json == {'error': 'Internal Server Error'}
|
||||
assert response.json == {"error": "Internal Server Error"}
|
||||
|
||||
Reference in New Issue
Block a user