コード例 #1
0
    def test_data_serialization(self):
        wrapper = SerializerClient()

        responses.add(responses.POST,
                      self.wrapper.test().data,
                      body='{}',
                      status=200,
                      content_type='application/json')

        string_date = '2014-11-13T14:53:18.694072+00:00'
        string_decimal = '1.45'

        data = {
            'date': arrow.get(string_date).datetime,
            'decimal': Decimal(string_decimal),
        }

        wrapper.test().post(data=data)

        request_body = responses.calls[0].request.body

        self.assertEqual(json.loads(request_body), {
            'date': string_date,
            'decimal': string_decimal
        })
コード例 #2
0
 def setUp(self):
     self.wrapper = SerializerClient()