Exemple #1
0
 def testFloorEnergyGoal(self):
   profile = self.user.get_profile()
   points = profile.points
   
   goal = FloorEnergyGoal(
       floor=self.floor, 
       goal_usage=str(1.0), 
       actual_usage=str(0.5),
   )
   goal.save()
   profile = Profile.objects.get(user__username="******")
   self.assertEqual(profile.points, points, 
       "User that did not complete the setup process should not be awarded points.")
   
   profile.setup_complete = True
   profile.save()
   
   goal.actual_usage = "1.5"
   goal.save()
   profile = Profile.objects.get(user__username="******")
   self.assertEqual(profile.points, points, 
       "Floor that failed the goal should not be awarded any points.")
       
   goal.actual_usage = "0.5"
   goal.save()
   profile = Profile.objects.get(user__username="******")
   self.assertEqual(profile.points, points + FloorEnergyGoal.GOAL_POINTS,
       "User that setup their profile should be awarded points.")