def testRunBackgroundTasksForDay(self): self.assertEqual(gamified.getStoredScore(self.user), (0, 0)) components = gamified.runBackgroundTasks(self.user.uuid) expectedScore = 0.75 * 50 + 30 * self.allDriveMinusMineExpect + 20 * 0.0 + \ 10 * self.sb375DailyGoalMinusMineExpect storedScore = gamified.getStoredScore(self.user) self.assertEqual(storedScore[0], 0) self.assertAlmostEqual(storedScore[1], expectedScore, 6)
def testUpdateScore(self): self.assertEqual(gamified.getStoredScore(self.user), (0, 0)) components = gamified.updateScore(self.user.uuid) print "self.allDriveMinusMineExpect = %s, self.sb375DailyGoalMinusMineExpect = %s" % \ (self.allDriveMinusMineExpect, self.sb375DailyGoalMinusMineExpect) expectedScore = 0.75 * 50 + 30 * self.allDriveMinusMineExpect + 20 * 0.0 + \ 10 * self.sb375DailyGoalMinusMineExpect storedScore = gamified.getStoredScore(self.user) self.assertEqual(storedScore[0], 0) self.assertAlmostEqual(storedScore[1], expectedScore, 6)