def test_decayRatings(self):
oldCount = self.teams.updateMatchingEntities.call_count
self._setProp(self.league.SET_RATING_DECAY, "0")
current = datetime.strftime(datetime.now(), self.league.TIMEFORMAT)
self._setProp(self.league.SET_LATEST_RUN, current)
self.league._decayRatings()
self._setProp(self.league.SET_RATING_DECAY, "10")
self.league._decayRatings()
assert_equals(self.teams.updateMatchingEntities.call_count, oldCount)
self._setProp(self.league.SET_LATEST_RUN, "")
self.teams.findEntities.return_value = [{'ID': 1, 'Rating': '33/5',
'Ongoing': '0', 'Finished': '8', 'Limit': '0', 'Confirmations': ''},
{'ID': 2, 'Rating': '34/8', 'Ongoing': '1', 'Finished': '0',
'Limit': '3', 'Confirmations': 'TRUE,FALSE,FALSE'},
{'ID': 3, 'Rating': '39/1', 'Ongoing': '2', 'Finished': '121',
'Limit': '12', 'Confirmations': 'TRUE,TRUE,TRUE'},
{'ID': 4, 'Rating': '12/0', 'Ongoing': '0', 'Finished': '0',
'Limit': '0', 'Confirmations': 'FALSE,FALSE,FALSE'}]
self.league._decayRatings()
self.teams.updateMatchingEntities.assert_called_with({'ID':
{'value': 2, 'type': 'positive'}}, {'Rating': "24/8"})
assert_equals(self.teams.updateMatchingEntities.call_count, 2)
评论列表
文章目录