Skip to content

Commit b8dac3e

Browse files
committed
Rename end to end tests to not confuse pytest
1 parent caabc63 commit b8dac3e

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

tests/test_end_to_end/fastapi/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def ping():
2323
test_router = APIRouter()
2424

2525

26-
class TestEnum(Enum):
26+
class AnEnum(Enum):
2727
""" For testing Enums in all the ways they can be used """
2828

2929
FIRST_VALUE = "FIRST_VALUE"
@@ -36,17 +36,17 @@ class OtherModel(BaseModel):
3636
a_value: str
3737

3838

39-
class TestModel(BaseModel):
39+
class AModel(BaseModel):
4040
""" A Model for testing all the ways custom objects can be used """
4141

42-
an_enum_value: TestEnum
43-
a_list_of_enums: List[TestEnum]
42+
an_enum_value: AnEnum
43+
a_list_of_enums: List[AnEnum]
4444
a_list_of_strings: List[str]
4545
a_list_of_objects: List[OtherModel]
4646

4747

48-
@test_router.get("/", response_model=List[TestModel])
49-
def test_getting_lists(statuses: List[TestEnum] = Query(...),):
48+
@test_router.get("/", response_model=List[AModel])
49+
def get_list(statuses: List[AnEnum] = Query(...),):
5050
""" Get users, filtered by statuses """
5151
return
5252

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"openapi": "3.0.2", "info": {"title": "My Test API", "description": "An API for testing openapi-python-client", "version": "0.1.0"}, "paths": {"/ping": {"get": {"summary": "Ping", "description": "A quick check to see if the system is running ", "operationId": "ping_ping_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/_ABCResponse"}}}}}}}, "/tests/": {"get": {"tags": ["users"], "summary": "Test Getting Lists", "description": "Get users, filtered by statuses ", "operationId": "test_getting_lists_tests__get", "parameters": [{"required": true, "schema": {"title": "Statuses", "type": "array", "items": {"enum": ["FIRST_VALUE", "SECOND_VALUE"]}}, "name": "statuses", "in": "query"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"title": "Response Test Getting Lists Tests Get", "type": "array", "items": {"$ref": "#/components/schemas/TestModel"}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"HTTPValidationError": {"title": "HTTPValidationError", "type": "object", "properties": {"detail": {"title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}}}}, "OtherModel": {"title": "OtherModel", "required": ["a_value"], "type": "object", "properties": {"a_value": {"title": "A Value", "type": "string"}}, "description": "A different model for calling from TestModel "}, "TestModel": {"title": "TestModel", "required": ["an_enum_value", "a_list_of_enums", "a_list_of_strings", "a_list_of_objects"], "type": "object", "properties": {"an_enum_value": {"title": "An Enum Value", "enum": ["FIRST_VALUE", "SECOND_VALUE"]}, "a_list_of_enums": {"title": "A List Of Enums", "type": "array", "items": {"enum": ["FIRST_VALUE", "SECOND_VALUE"]}}, "a_list_of_strings": {"title": "A List Of Strings", "type": "array", "items": {"type": "string"}}, "a_list_of_objects": {"title": "A List Of Objects", "type": "array", "items": {"$ref": "#/components/schemas/OtherModel"}}}, "description": "A Model for testing all the ways custom objects can be used "}, "ValidationError": {"title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": {"loc": {"title": "Location", "type": "array", "items": {"type": "string"}}, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}}}, "_ABCResponse": {"title": "_ABCResponse", "required": ["success"], "type": "object", "properties": {"success": {"title": "Success", "type": "boolean"}}}}}}
1+
{"openapi": "3.0.2", "info": {"title": "My Test API", "description": "An API for testing openapi-python-client", "version": "0.1.0"}, "paths": {"/ping": {"get": {"summary": "Ping", "description": "A quick check to see if the system is running ", "operationId": "ping_ping_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/_ABCResponse"}}}}}}}, "/tests/": {"get": {"tags": ["users"], "summary": "Get List", "description": "Get users, filtered by statuses ", "operationId": "get_list_tests__get", "parameters": [{"required": true, "schema": {"title": "Statuses", "type": "array", "items": {"enum": ["FIRST_VALUE", "SECOND_VALUE"]}}, "name": "statuses", "in": "query"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"title": "Response Get List Tests Get", "type": "array", "items": {"$ref": "#/components/schemas/AModel"}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"AModel": {"title": "AModel", "required": ["an_enum_value", "a_list_of_enums", "a_list_of_strings", "a_list_of_objects"], "type": "object", "properties": {"an_enum_value": {"title": "An Enum Value", "enum": ["FIRST_VALUE", "SECOND_VALUE"]}, "a_list_of_enums": {"title": "A List Of Enums", "type": "array", "items": {"enum": ["FIRST_VALUE", "SECOND_VALUE"]}}, "a_list_of_strings": {"title": "A List Of Strings", "type": "array", "items": {"type": "string"}}, "a_list_of_objects": {"title": "A List Of Objects", "type": "array", "items": {"$ref": "#/components/schemas/OtherModel"}}}, "description": "A Model for testing all the ways custom objects can be used "}, "HTTPValidationError": {"title": "HTTPValidationError", "type": "object", "properties": {"detail": {"title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}}}}, "OtherModel": {"title": "OtherModel", "required": ["a_value"], "type": "object", "properties": {"a_value": {"title": "A Value", "type": "string"}}, "description": "A different model for calling from TestModel "}, "ValidationError": {"title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": {"loc": {"title": "Location", "type": "array", "items": {"type": "string"}}, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}}}, "_ABCResponse": {"title": "_ABCResponse", "required": ["success"], "type": "object", "properties": {"success": {"title": "Success", "type": "boolean"}}}}}}

tests/test_end_to_end/golden-master/my_test_api_client/api/users.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
from ..client import AuthenticatedClient, Client
77
from ..errors import ApiResponseError
8+
from ..models.a_model import AModel
89
from ..models.h_t_t_p_validation_error import HTTPValidationError
910
from ..models.statuses import Statuses
10-
from ..models.test_model import TestModel
1111

1212

13-
def test_getting_lists_tests__get(
13+
def get_list_tests__get(
1414
*, client: Client, statuses: List[Statuses],
1515
) -> Union[
16-
List[TestModel], HTTPValidationError,
16+
List[AModel], HTTPValidationError,
1717
]:
1818
""" Get users, filtered by statuses """
1919
url = f"{client.base_url}/tests/"
@@ -25,7 +25,7 @@ def test_getting_lists_tests__get(
2525
response = httpx.get(url=url, headers=client.get_headers(), params=params,)
2626

2727
if response.status_code == 200:
28-
return [TestModel.from_dict(item) for item in response.json()]
28+
return [AModel.from_dict(item) for item in response.json()]
2929
if response.status_code == 422:
3030
return HTTPValidationError.from_dict(response.json())
3131
else:

tests/test_end_to_end/golden-master/my_test_api_client/async_api/users.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
from ..client import AuthenticatedClient, Client
77
from ..errors import ApiResponseError
8+
from ..models.a_model import AModel
89
from ..models.h_t_t_p_validation_error import HTTPValidationError
910
from ..models.statuses import Statuses
10-
from ..models.test_model import TestModel
1111

1212

13-
async def test_getting_lists_tests__get(
13+
async def get_list_tests__get(
1414
*, client: Client, statuses: List[Statuses],
1515
) -> Union[
16-
List[TestModel], HTTPValidationError,
16+
List[AModel], HTTPValidationError,
1717
]:
1818
""" Get users, filtered by statuses """
1919
url = f"{client.base_url}/tests/"
@@ -23,10 +23,12 @@ async def test_getting_lists_tests__get(
2323
}
2424

2525
with httpx.AsyncClient() as client:
26-
response = await client.get(url=url, headers=client.get_headers(), params=params,)
26+
response = await client.get(
27+
url=url, headers=client.get_headers(), params=params,
28+
)
2729

2830
if response.status_code == 200:
29-
return [TestModel.from_dict(item) for item in response.json()]
31+
return [AModel.from_dict(item) for item in response.json()]
3032
if response.status_code == 422:
3133
return HTTPValidationError.from_dict(response.json())
3234
else:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
""" Contains all the data models used in inputs/outputs """
22

33
from .a_list_of_enums import AListOfEnums
4+
from .a_model import AModel
45
from .abc_response import ABCResponse
56
from .an_enum_value import AnEnumValue
67
from .h_t_t_p_validation_error import HTTPValidationError
78
from .other_model import OtherModel
89
from .statuses import Statuses
9-
from .test_model import TestModel
1010
from .validation_error import ValidationError

tests/test_end_to_end/golden-master/my_test_api_client/models/test_model.py renamed to tests/test_end_to_end/golden-master/my_test_api_client/models/a_model.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@dataclass
13-
class TestModel:
13+
class AModel:
1414
""" A Model for testing all the ways custom objects can be used """
1515

1616
an_enum_value: AnEnumValue
@@ -27,9 +27,11 @@ def to_dict(self) -> Dict:
2727
}
2828

2929
@staticmethod
30-
def from_dict(d: Dict) -> TestModel:
30+
def from_dict(d: Dict) -> AModel:
3131

32-
an_enum_value = AnEnumValue(d["an_enum_value"]) if "an_enum_value" in d else None
32+
an_enum_value = (
33+
AnEnumValue(d["an_enum_value"]) if "an_enum_value" in d else None
34+
)
3335

3436
a_list_of_enums = []
3537
for a_list_of_enums_item in d.get("a_list_of_enums", []):
@@ -40,7 +42,7 @@ def from_dict(d: Dict) -> TestModel:
4042
a_list_of_objects = []
4143
for a_list_of_objects_item in d.get("a_list_of_objects", []):
4244
a_list_of_objects.append(OtherModel.from_dict(a_list_of_objects_item))
43-
return TestModel(
45+
return AModel(
4446
an_enum_value=an_enum_value,
4547
a_list_of_enums=a_list_of_enums,
4648
a_list_of_strings=a_list_of_strings,

0 commit comments

Comments
 (0)