Skip to content

Conversation

@rookedsysc
Copy link
Collaborator

변경 사항

TradeService 테스트에서 _record_balance() 메서드 호출 시 필요한 mock이 누락되어 발생한 테스트 실패를 수정했습니다.

수정된 테스트

  1. test_execute_no_active_coins

    • mock_upbit_clientmock_balance_repository fixture 추가
    • get_krw_balance 반환값 설정
  2. test_execute_zero_krw_balance

    • 비즈니스 로직에 맞게 테스트 시나리오 수정
    • AI 분석 mock (get_ohlcv_raw, get_bitcoin_trading_decision) 추가
    • get_coin_balance, get_current_price 반환값 설정

테스트 결과

모든 29개 테스트 통과

- test_execute_no_active_coins: mock_upbit_client 추가하여 get_krw_balance 설정
- test_execute_zero_krw_balance: 비즈니스 로직에 맞게 AI 분석 mock 추가 및 시나리오 수정
@github-actions
Copy link

커버리지

Backend 테스트 커버리지 리포트
FileStmtsMissCoverMissing
main.py770%7, 9, 12–13, 16–17, 21
ai/client
   open_ai_client.py13561%12, 15, 27–29
ai/const
   constans.py20100% 
ai/dto
   ai_analysis_response.py180100% 
ballance/model
   balance.py110100% 
ballance/repository
   balance_repository.py18950%18, 22, 25, 37, 39–40, 42–44
coin/model
   coin.py110100% 
coin/repository
   coin_repository.py20955%18, 22–23, 27, 30, 34–35, 39–40
coin/service
   coin_service.py301936%20–21, 25, 37, 39–41, 46–47, 50–51, 63–64, 66–67, 72–73, 78–79
common/model
   base.py281353%24, 26–27, 29–33, 39, 50, 60, 70–71
common/repository
   base_repository.py261446%25–26, 30–33, 37, 41–42, 46–48, 52–53
configs
   config.py18383%46–48
trade/dto
   transaction_response.py230100% 
trade/model
   enums.py160100% 
   trade.py26292%48, 53
trade/repository
   trade_repository.py221150%19, 23, 28, 36, 41, 53, 56–57, 60, 62–63
trade/service
   trade_service.py149497%95–96, 99, 195
upbit/client
   upbit_client.py442738%14–16, 27, 29–30, 34, 47, 58, 60–61, 65, 69–71, 74, 83, 92–93, 101–102, 105–109, 111
upbit/dto
   coin_balance.py40100% 
   my_ballance_response.py60100% 
   ohlcv_dto.py120100% 
TOTAL50412375% 

Tests Skipped Failures Errors Time
29 0 💤 0 ❌ 0 🔥 0.950s ⏱️

@rookedsysc rookedsysc merged commit 9aa28d3 into main Nov 22, 2025
2 checks passed
@rookedsysc rookedsysc self-assigned this Nov 22, 2025
@rookedsysc rookedsysc deleted the feat/update-balance branch November 22, 2025 13:47
YounaJ00 pushed a commit that referenced this pull request Nov 24, 2025
* modify: 잔고 항상 기록하도록 변경  krw 0원일 때 어차피 밑에서 검증함 삭제

* fix(test): _record_balance 호출에 필요한 mock 설정 추가

- test_execute_no_active_coins: mock_upbit_client 추가하여 get_krw_balance 설정
- test_execute_zero_krw_balance: 비즈니스 로직에 맞게 AI 분석 mock 추가 및 시나리오 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants