You've already forked RekomenciBackend
add resume
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
from typing import Any
|
||||
|
||||
from httpx import AsyncClient, Response
|
||||
|
||||
|
||||
def make_auth_headers(access_token: str | None) -> dict[str, Any]:
|
||||
return {} if access_token is None else {"Authorization": f"Bearer {access_token}"}
|
||||
|
||||
|
||||
class TestApiGateway:
|
||||
def __init__(self, client: AsyncClient) -> None:
|
||||
self._client = client
|
||||
@@ -18,11 +24,9 @@ class TestApiGateway:
|
||||
)
|
||||
|
||||
async def get_profile(self, access_token: str | None) -> Response:
|
||||
headers = {} if access_token is None else {"Authorization": f"Bearer {access_token}"}
|
||||
|
||||
return await self._client.get(
|
||||
"/profile",
|
||||
headers=headers,
|
||||
headers=make_auth_headers(access_token),
|
||||
)
|
||||
|
||||
async def patch_profile(
|
||||
@@ -34,8 +38,6 @@ class TestApiGateway:
|
||||
avatar_url: str | None = None,
|
||||
phone: str | None = None,
|
||||
) -> Response:
|
||||
headers = {} if access_token is None else {"Authorization": f"Bearer {access_token}"}
|
||||
|
||||
return await self._client.patch(
|
||||
"/profile",
|
||||
json={
|
||||
@@ -49,5 +51,30 @@ class TestApiGateway:
|
||||
}.items()
|
||||
if value is not None
|
||||
},
|
||||
headers=headers,
|
||||
headers=make_auth_headers(access_token),
|
||||
)
|
||||
|
||||
async def create_resume(
|
||||
self,
|
||||
access_token: str,
|
||||
position: str,
|
||||
about_me: str,
|
||||
key_skills: list[str],
|
||||
experience_type: str,
|
||||
) -> Response:
|
||||
return await self._client.post(
|
||||
"/resume",
|
||||
json={
|
||||
"position": position,
|
||||
"about_me": about_me,
|
||||
"key_skills": key_skills,
|
||||
"experience_type": experience_type,
|
||||
},
|
||||
headers=make_auth_headers(access_token),
|
||||
)
|
||||
|
||||
async def get_resume(self, access_token: str, resume_id: str) -> Response:
|
||||
return await self._client.get(
|
||||
f"/resume/{resume_id}",
|
||||
headers=make_auth_headers(access_token),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user