def test_error(self):
     resp = Mock()
     json_response = rest.new(resp)
     errors = json_response.context
     self.assertEqual(500, resp.status_code)
     self.assertSetEqual(set(['nome']), set(errors.keys()))
     self.assert_can_serialize_as_json(json_response)
 def test_success(self):
     self.assertIsNone(Course.query().get())
     json_response = rest.new(None, nome='nome_string')
     db_course = Course.query().get()
     self.assertIsNotNone(db_course)
     self.assertEquals('nome_string', db_course.nome)
     self.assert_can_serialize_as_json(json_response)
 def test_success(self):
     self.assertIsNone(Course.query().get())
     json_response = rest.new(None, nome='nome_string')
     db_course = Course.query().get()
     self.assertIsNotNone(db_course)
     self.assertEquals('nome_string', db_course.nome)
     self.assert_can_serialize_as_json(json_response)
 def test_error(self):
     resp = Mock()
     json_response = rest.new(resp)
     errors = json_response.context
     self.assertEqual(500, resp.status_code)
     self.assertSetEqual(set(['nome']), set(errors.keys()))
     self.assert_can_serialize_as_json(json_response)
Example #5
0
 def test_erro_validacao(self):
     resposta = Mock()
     rest.new(resposta)
     self.assertEqual(400, resposta.status_code)