feat(): update resume contracts

This commit is contained in:
gitgernit
2025-11-22 17:30:46 +03:00
parent 995141a200
commit 2963460b1c
16 changed files with 847 additions and 64 deletions
+16
View File
@@ -33,6 +33,7 @@ async def test_success_add_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
assert is_success_response(response)
assert response.json() == IsDict(
@@ -54,6 +55,7 @@ async def test_unauthorized_add_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
assert is_unauthorized_response(response)
@@ -75,6 +77,7 @@ async def test_success_get_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
response = await test_api_gateway.get_resume(
@@ -84,9 +87,13 @@ async def test_success_get_resume(
assert is_success_response(response)
assert response.json() == IsPartialDict(
position="Position",
location="Moscow",
about_me="About me",
key_skills=["i love lisp", "i love rust"],
experience_type="noExperience",
experience=[],
education=[],
projects=[],
prediction=None,
)
@@ -108,6 +115,7 @@ async def test_unauthorized_get_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
response = await test_api_gateway.get_resume(
@@ -152,6 +160,7 @@ async def test_success_edit_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
resume_id = response.json()["resume_id"]
response = await test_api_gateway.edit_resume(
@@ -161,13 +170,18 @@ async def test_success_edit_resume(
experience_type="between1And3",
key_skills=["i love python"],
position="Updated Position",
location="St. Petersburg",
)
assert is_success_response(response)
assert response.json() == IsPartialDict(
position="Updated Position",
location="St. Petersburg",
about_me="Updated about me",
key_skills=["i love python"],
experience_type="between1And3",
experience=[],
education=[],
projects=[],
)
@@ -188,6 +202,7 @@ async def test_unauthorized_edit_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
resume_id = response.json()["resume_id"]
response = await test_api_gateway.edit_resume(
@@ -239,6 +254,7 @@ async def test_forbidden_edit_resume(
experience_type="noExperience",
key_skills=["i love lisp", "i love rust"],
position="Position",
location="Moscow",
)
response_other_sign_up = await test_api_gateway.sign_up_email("f" + unique_email, DEFAULT_PASSWORD)
+40 -16
View File
@@ -58,18 +58,30 @@ class TestApiGateway:
self,
access_token: str,
position: str,
location: str,
about_me: str,
key_skills: list[str],
experience_type: str,
experience: list[dict[str, Any]] | None = None,
education: list[dict[str, Any]] | None = None,
projects: list[dict[str, Any]] | None = None,
) -> Response:
json_data: dict[str, Any] = {
"position": position,
"location": location,
"about_me": about_me,
"key_skills": key_skills,
"experience_type": experience_type,
}
if experience is not None:
json_data["experience"] = experience
if education is not None:
json_data["education"] = education
if projects is not None:
json_data["projects"] = projects
return await self._client.post(
"/resume",
json={
"position": position,
"about_me": about_me,
"key_skills": key_skills,
"experience_type": experience_type,
},
json=json_data,
headers=make_auth_headers(access_token),
)
@@ -84,22 +96,34 @@ class TestApiGateway:
access_token: str,
resume_id: str,
position: str | None = None,
location: str | None = None,
about_me: str | None = None,
key_skills: list[str] | None = None,
experience_type: str | None = None,
experience: list[dict[str, Any]] | None = None,
education: list[dict[str, Any]] | None = None,
projects: list[dict[str, Any]] | None = None,
) -> Response:
json_data: dict[str, Any] = {}
if position is not None:
json_data["position"] = position
if location is not None:
json_data["location"] = location
if about_me is not None:
json_data["about_me"] = about_me
if key_skills is not None:
json_data["key_skills"] = key_skills
if experience_type is not None:
json_data["experience_type"] = experience_type
if experience is not None:
json_data["experience"] = experience
if education is not None:
json_data["education"] = education
if projects is not None:
json_data["projects"] = projects
return await self._client.patch(
f"/resume/{resume_id}",
json={
key: value
for key, value in {
"position": position,
"about_me": about_me,
"key_skills": key_skills,
"experience_type": experience_type,
}.items()
if value is not None
},
json=json_data,
headers=make_auth_headers(access_token),
)