def test_output_other(self):
     field = GenericReferenceField()
     instance = OtherReferencedDoc.objects.create(name="foo")
     strid = str(instance.id)
     ref = instance.to_dbref()
     assert field.to_representation(instance) == {'_cls': 'OtherReferencedDoc', '_id': strid}
     assert field.to_representation(ref) == {'_cls': 'OtherReferencedDoc', '_id': strid}
 def test_output_other(self):
     field = GenericReferenceField()
     instance = OtherReferencedDoc.objects.create(name="foo")
     strid = str(instance.id)
     ref = instance.to_dbref()
     assert field.to_representation(instance) == {'_cls': 'OtherReferencedDoc', '_id': strid}
     assert field.to_representation(ref) == {'_cls': 'OtherReferencedDoc', '_id': strid}
 def test_output(self):
     field = GenericReferenceField()
     instance = ReferencedModel.objects.create(name="foo")
     ref = instance.to_dbref()
     strid = str(instance.id)
     assert field.to_representation(instance) == {'_cls': 'ReferencedModel', '_id': strid}
     assert field.to_representation(ref) == {'_cls': 'ReferencedModel', '_id': strid}
 def test_input_other(self):
     field = GenericReferenceField()
     instance = OtherReferencedDoc.objects.create(name="foo")
     ref = instance.to_dbref()
     assert field.to_internal_value({
         '_cls': 'OtherReferencedDoc',
         '_id': str(instance.id)
     }) == ref
 def test_input_other(self):
     field = GenericReferenceField()
     instance = OtherReferencedDoc.objects.create(name="foo")
     ref = instance.to_dbref()
     assert field.to_internal_value({'_cls': 'OtherReferencedDoc', '_id': str(instance.id)}) == ref
 def test_input(self):
     field = GenericReferenceField()
     instance = ReferencedModel.objects.create(name="foo")
     ref = instance.to_dbref()
     value = field.to_internal_value({'_cls': 'ReferencedModel', '_id': str(instance.id)})
     assert value == ref