예제 #1
0
 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')))
예제 #2
0
 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')))
예제 #3
0
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'))
예제 #4
0
 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")))
예제 #5
0
 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))
예제 #6
0
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'))