Beispiel #1
0
 def test_load_last_score(self): 
     """ Latest score should be loaded """
     save_score(11)
     score = load_last_score()
     self.assertTrue(score == 11)
     save_score(4)
     score = load_last_score()
     self.assertTrue(score == 4)
Beispiel #2
0
 def test_get_best(self):
     """ Best score should be kept """
     save_score(11)
     best = get_best()
     self.assertTrue(best ==11)
     save_score(15)
     best = get_best()
     self.assertTrue(best ==15)
     save_score(2)
     best = get_best()
     self.assertTrue(best ==15)
Beispiel #3
0
 def test_save_score(self):
     """Score should be saved properly"""
     save_score(11)
     score = load_last_score()
     self.assertTrue(score == 11)
Beispiel #4
0
def api_save_score():
    req_json = request.get_json()
    score = req_json["score"]
    save_score(score)
    return jsonify( {"score" : str(load_last_score()) } )