def test_json(self): from ..main.models import Author from adrest.utils.serializer import JSONSerializer authors = Author.objects.all() worker = JSONSerializer() test = worker.serialize(authors) self.assertTrue("main.author" in test)
def adrest_jsonify(content, **options): """ Serialize any object to JSON . :return str: Rendered string. """ from adrest.utils.serializer import JSONSerializer worker = JSONSerializer(**options) return worker.serialize(content)
def test_json(self): from ...main.models import Author from adrest.utils.serializer import JSONSerializer authors = Author.objects.all() worker = JSONSerializer(options=dict(separators=(',', ':'))) test = worker.serialize(authors) self.assertTrue("main.author" in test) self.assertTrue('":{"' in test)
def test_json(self): from ...main.models import Author from adrest.utils.serializer import JSONSerializer authors = Author.objects.all() worker = JSONSerializer(options=dict( separators=(',', ':') )) test = worker.serialize(authors) self.assertTrue("main.author" in test) self.assertTrue('"fields":{"active":true,"name"' in test)
def adrest_jsonify(content, **options): " Serialize to JSON any object. " from adrest.utils.serializer import JSONSerializer worker = JSONSerializer(**options) return worker.serialize(content)