def test_dbref(self):
    self.round_trip({'ref': DBRef('foo', 5)})
    self.round_trip({'ref': DBRef('foo', 5, 'db')})
    self.round_trip({'ref': DBRef('foo', ObjectId())})
    self.assertEqual('{"$ref": "collection", "$id": 1, "$db": "db"}', json_util.dumps(DBRef('collection', 1, 'db')))
def test_dbref(self):
    self.round_trip({'ref': DBRef('foo', 5)})
    self.round_trip({'ref': DBRef('foo', 5, 'db')})
    self.round_trip({'ref': DBRef('foo', ObjectId())})
    self.assertEqual('{"$ref": "collection", "$id": 1, "$db": "db"}', json_util.dumps(DBRef('collection', 1, 'db')))