def test_json(self): EUR = MoneyMaker('EUR') renderer = JSONRenderer() data = {'amount': EUR('1.23')} rendered_json = renderer.render(data, 'application/json') self.assertDictEqual({'amount': "€ 1.23"}, json.loads(rendered_json.decode('utf-8')))
def test_json_renderer(): renderer = JSONRenderer() data = {'amount': EUR('1.23')} rendered_json = renderer.render(data, 'application/json') assert {'amount': "€ 1.23"} == json.loads(rendered_json.decode('utf-8'))
def test_json(self): EUR = MoneyMaker("EUR") renderer = JSONRenderer() data = {"amount": EUR("1.23")} rendered_json = renderer.render(data, "application/json") self.assertDictEqual({"amount": "€ 1.23"}, json.loads(rendered_json.decode("utf-8")))
def test_json(self): Money = MoneyMaker('EUR') renderer = JSONRenderer() data = {'amount': Money('1.23')} rendered_json = renderer.render(data, 'application/json') self.assertDictEqual({'amount': '€ 1.23'}, json.loads(rendered_json))