def test_get_details(self): # make fake new game 12345 # TODO: mock out HR / DR construction as well? hr = HistoryResponse({ 'status': 1, 'results_remaining': 0, 'num_results': 1, 'total_results': 1, 'matches': [{ 'match_id': 12345 }] }) dr = DetailsResponse({ 'radiant_win': 1, 'match_id': 12345, 'players': [], 'negative_votes': 1, 'positive_votes': 1, 'lobby_type': 1, 'duration': 1, 'first_blood_time': 1, 'leagueid': 1, 'start_time': 1, 'dire_name': 1, 'radiant_name': 1, 'dire_team_id': 1, 'radiant_team_id': 1 }) with patch.object(API, 'get_match_history', return_value=hr): with patch.object(API, 'get_match_details', return_value=dr): get_details_by_id.get_details(steam_id=1, key='fake', data_dir=pathlib.Path('.')) new = pathlib.Path('12345.json') self.assertTrue(new.exists())
def setUp(self): with open('details_response.json') as f: self.dr = DetailsResponse(json.load(f))