예제 #1
0
 def test_output_error(self):
     message = messages.Response(status_code=500)
     renderer = Json()
     vm = sample_view_model()
     vm.data['debug'] = False
     output = renderer._formatted_error(vm, context={'response': message})
     assert output['name'] == 'Unknown Error'
 def test_output(self):
     renderer = Xml()
     output = renderer(sample_view_model())
     assert (
         output
         == '<?xml version="1.0" encoding="utf-8" ?><test><nodes><node>Testing</node><node>Another node</node></nodes></test>'
     )
 def test_output(self):
     renderer = Json()
     output = renderer(sample_view_model())
     assert output == '{"test": {"nodes": {"node": ["Testing", "Another node"]}}}'
예제 #4
0
 def test_output(self):
     renderer = Json()
     output = renderer(sample_view_model())
     assert output == '{"test": {"nodes": {"node": ["Testing", "Another node"]}}}'
예제 #5
0
 def test_output(self):
     renderer = Xml()
     output = renderer(sample_view_model())
     assert output == '<?xml version="1.0" encoding="utf-8" ?><test><nodes><node>Testing</node><node>Another node</node></nodes></test>'