def test_make_log_random(self): # 测试随机金币 user = User.objects.create_user('jeff', '*****@*****.**', '123') task = Task(name='check in', key='check_in', cost=10, cost_max=100) task.save() log = task.make_log(user) assert log.cost >= 10 and log.cost <= 100
def test_make_log_infinity(self): # 测试随机金币 user = User.objects.create_user('jeff', '*****@*****.**', '123') task = Task(name='check in', key='check_in', cost=10) task.save() log = task.make_log(user) self.assertEqual(10, log.cost) log = task.make_log(user) self.assertEqual(10, log.cost)