dkim72409371
@dkim72409371
Reviews Written
8
Average Rating
5.0
Posts
Q&A
351์ชฝ ์ง๋ฌธ
์, 362์ชฝ์ ์ฝ๋๋ฅผ ์ ๊ณตํด์ฃผ์ จ๋ค์. ์ฃ์กํฉ๋๋ค ^^;
- 0
- 2
- 31
Q&A
4์ฃผ 2ํ์ฐจ ๊ณผ์ ์ง๋ฌธ
์๊ฐ๋ ๋น ๋ฅธ ๋ต๋ณ ๊ฐ์ฌ ๋๋ฆฝ๋๋ค! ์ฃ์กํฉ๋๋ค. ์ ๊ฐ ํ์ด์ฌ๊ณผ Fast API ์ ๋ฌธํ ์ง ์ผ๋ง ์๋์ ๊ทธ๋ฐ์ง ์์ง ๊ณผ์ ์๊ตฌ ์ฌํญ์ด ์ดํด๊ฐ ์ ๋์ง ์์ต๋๋ค ใ ใ . ์๋ ์ฑ ์ ์์ test_timeslot_api.py ์์ ์๊ฐ๋ ๋ง์์ ์ฐธ์กฐํ์ฌ, 18์ - 19์ ์ ๊ฐ ํ์ ์ฌ๋กฏ์ ๋จผ์ ์์ฑ ํ, ํ ์คํธ ์ผ์ด์ค๋ก 18์ 30๋ถ ๋ถํฐ 19์ 10๋ถ๊น์ง ์งํ๋๋ ํ์์ฌ๋กฏ์ ์ถ๊ฐ ํ๋ ค๋ ํ ์คํธ๋ฅผ ํด๋ณด์๋๋ฐ, ์ค๋ณต ๊ฒ์ฌ ํ ์คํธ๋ฅผ ํต๊ณผ ํ์์ต๋๋ค. ์ฑ 309์ชฝ์์ ์๊ฐ๋์ด ์ ๊ณตํด์ฃผ์ ์๋ ์ฝ๋๊ฐ ๋ชจ๋ ํ์ ์ฌ๋กฏ ์ค๋ณต ๊ฒ์ฌ๋ฅผ ์ ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. stmt = select(TimeSlot).where( and_( TimeSlot.calendar_id == user.calendar.id, TimeSlot.start_time payload.start_time ) ) result = await session.execute(stmt) existing_time_slots = result.scalars().all() for existing_time_slot in existing_time_slots: if any(day in existing_time_slot.weekdays for day in payload.weekdays): raise TimeSlotOverlapError()@pytest.mark.parametrize("start_time, end_time, weekdays, expected_status_code", [ (time(18, 30), time(19, 10), [calendar.MONDAY], status.HTTP_422_UNPROCESSABLE_CONTENT), ]) @pytest.mark.usefixtures("host_user_calendar") async def test_๊ฒน์น๋_์๊ฐ๋๊ฐ_์๋_๊ฒฝ์ฐ_HTTP_422_์๋ต์_ํ๋ค( client_with_auth: TestClient, start_time: time, end_time: time, weekdays: list[int], expected_status_code: int, ): # ์ฒซ ๋ฒ์งธ ํ์์ฌ๋กฏ ์์ฑ payload = { "start_time": time(18, 00).isoformat(), "end_time": time(19, 00).isoformat(), "weekdays": [calendar.MONDAY, calendar.TUESDAY, calendar.WEDNESDAY], } response = client_with_auth.post("/time-slots", json=payload) assert response.status_code == status.HTTP_201_CREATED # ๋ ๋ฒ์งธ ํ์์ฌ๋กฏ ์์ฑ ์๋ payload = { "start_time": start_time.isoformat(), "end_time": end_time.isoformat(), "weekdays": weekdays, } print (payload) response = client_with_auth.post("/time-slots", json=payload) assert response.status_code == expected_status_code
- 0
- 3
- 32




