def test_does_not_download_game_if_there_is_no_interested_player_in_it(self): self.last_match_seq.return_value = 0 self.accounts_to_download_matches.return_value = [9] match0 = build_match_mock(4, [3]) match1 = build_match_mock(5, [1]) request = mock.Mock() request.matches = [match0, match1] self.d2api.get_matches_seq.return_value = request tasks._download_by_seq_num() self.d2api.get_matches_seq.assert_called_with(0) self.set_last_match_seq.assert_called_with(5) self.assertFalse(self.get_details_match.called)
def test_set_last_match_downloaded_if_none_is_downloaded(self): self.last_match_seq.return_value = None match = build_match_mock(321) request = mock.Mock() request.matches = [match] self.d2api.get_match_history.return_value = request self.d2api.get_matches_seq.return_value = request tasks._download_by_seq_num() self.set_last_match_seq.assert_called_with(321) self.d2api.get_match_history.assert_called_with(None) self.assertFalse(self.get_details_match.called)
def test_do_download_game_if_there_is_interested_player_in_it(self): self.last_match_seq.return_value = 1 self.accounts_to_download_matches.return_value = [9] match0 = build_match_mock(1) match1 = build_match_mock(4, [9]) match2 = build_match_mock(5) request = mock.Mock() request.matches = [match0, match1, match2] self.d2api.get_matches_seq.return_value = request tasks._download_by_seq_num() self.d2api.get_matches_seq.assert_called_with(1) self.set_last_match_seq.assert_called_with(5) self.get_details_match.assert_called_with(4)