def test_CsvwJsonAdapter(self): from clld.web.adapters.csv import CsvmJsonAdapter adapter = CsvmJsonAdapter(None) res = adapter.render( datatables.Languages(self.env['request'], Language), self.env['request']) self.assertIn('tableSchema', json.loads(res)) res = adapter.render( datatables.Valuesets(self.env['request'], ValueSet), self.env['request']) self.assertIn('foreignKeys', json.loads(res)['tableSchema']) adapter.render_to_response( datatables.Valuesets(self.env['request'], ValueSet), self.env['request'])
def test_CsvwJsonAdapter(request_factory, env): from clld.web.adapters.csv import CsvmJsonAdapter adapter = CsvmJsonAdapter(None) res = json.loads( adapter.render(datatables.Languages(env['request'], Language), env['request'])) assert res['tableSchema']['columns'] != [] res = adapter.render(datatables.Valuesets(env['request'], ValueSet), env['request']) assert 'foreignKeys' in json.loads(res)['tableSchema'] adapter.render_to_response(datatables.Valuesets(env['request'], ValueSet), env['request']) with request_factory(params={'sSearch_0': 'xyz'}) as req: res = json.loads( adapter.render(datatables.Languages(req, Language), req)) assert res['tableSchema']['columns'] == []