def test_update(self): FilmRepository.create(**self.film_dict) film_update = { "vals": { 'year': 1995, } } response = self.client.put( "/api/film/1", content_type="application/json", data=json.dumps(film_update), ) self.assertEqual(response.status_code, 200) response_json = json.loads(response.data.decode("utf-8")) check_dict = self.film_dict.copy() check_dict['id'] = 1 check_dict['year'] = 1995 self.assertEqual( response_json, {"film": check_dict}, ) film = FilmRepository.get(id=1) self.assertEqual(film.year, 1995)
def get(id): film = FilmRepository.get(id=id) return jsonify({"film": film.json})
def get(title, author): film = FilmRepository.get(title=title, author=author) return jsonify({"film": film.json})
def get(title): """ Return a film key information based on its title """ film = FilmRepository.get(title=title) return jsonify({"film": film.json})