def test_compose_sort(self): f, a = q_parse('/foo/bar/find_one', 'sort=hej:ASC,med:DESC,dig:ASC') func, args = compose(f, a) self.assertEqual(args['skip'], 0) self.assertEqual(args['limit'], 0) self.assertEqual(args['sort'], [('hej', pymongo.ASCENDING), ('med', pymongo.DESCENDING), ('dig', pymongo.ASCENDING)])
def test_compose_fields(self): f, a = q_parse('/foo/bar/find/hej,med,dig', '') func, args = compose(f, a) self.assertEqual(args['fields'], ['hej','med','dig'])
def test_find_sort_with_name(self): f, a = q_parse('/foo/bar/find/name/', 'sort=hej:ASC') func, args = compose(f, a) print func, args