Пример #1
0
 def test_success(self):
     course = mommy.save_one(Course)
     old_properties = course.to_dict()
     json_response = rest.edit(None, course.key.id(), nome='nome_string')
     db_course = course.key.get()
     self.assertEquals('nome_string', db_course.nome)
     self.assertNotEqual(old_properties, db_course.to_dict())
     self.assert_can_serialize_as_json(json_response)
Пример #2
0
 def test_error(self):
     course = mommy.save_one(Course)
     old_properties = course.to_dict()
     resp = Mock()
     json_response = rest.edit(resp, course.key.id())
     errors = json_response.context
     self.assertEqual(500, resp.status_code)
     self.assertSetEqual(set(['nome']), set(errors.keys()))
     self.assertEqual(old_properties, course.key.get().to_dict())
     self.assert_can_serialize_as_json(json_response)