def test_post(self): u = Users.get() f = Films.get() r = requests.post('http://localhost:9091/mark', json={ "user_id": u.user_id, "film_id": f.film_id, "result": 1, }) self.assertEqual(r.text, "ok") r = requests.post('http://localhost:9091/mark', json={ "film_id": f.film_id, "event": "trailer", }) self.assertEqual(r.text, "ok")
import requests from models import Users, Films u = Users.get() f = Films.get() r = requests.post('http://localhost:9091/mark', json={ "user_id": u.user_id, "film_id": f.film_id, "result": 1, })
def test_lite_data(self): u = Users.get() f = Films.get() res = self.fm.lite_data(model_to_dict(f), model_to_dict(u)) self.assertIsInstance(res, list) self.assertIsInstance(res[0], float)