예제 #1
0
 def test_error(self):
     resp = Mock()
     json_response = rest.new(resp)
     errors = json_response.context
     self.assertEqual(500, resp.status_code)
     self.assertSetEqual(set(['preco', 'nome']), set(errors.keys()))
     self.assert_can_serialize_as_json(json_response)
예제 #2
0
 def test_success(self):
     self.assertIsNone(Curso.query().get())
     json_response = rest.new(None, preco='1.01', nome='nome_string')
     db_curso = Curso.query().get()
     self.assertIsNotNone(db_curso)
     self.assertEquals(Decimal('1.01'), db_curso.preco)
     self.assertEquals('nome_string', db_curso.nome)
     self.assert_can_serialize_as_json(json_response)