Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
_id to id change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Feb 6, 2015
1 parent 78cefa2 commit 31e2a22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion readinglist/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def extract_record_set(records, filters, sorting,
paginated = {}
for rule in pagination_rules:
values = list(apply_filters(filtered, rule))
paginated.update(dict(((x['_id'], x) for x in values)))
paginated.update(dict(((x['id'], x) for x in values)))

if paginated:
paginated = paginated.values()
Expand Down
6 changes: 3 additions & 3 deletions readinglist/tests/resource/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def test_next_page_url_gives_next_page(self):
results1 = self.resource.collection_get()
self._setup_next_page()
results2 = self.resource.collection_get()
results_id1 = set([x['_id'] for x in results1['items']])
results_id2 = set([x['_id'] for x in results2['items']])
results_id1 = set([x['id'] for x in results1['items']])
results_id2 = set([x['id'] for x in results2['items']])
self.assertFalse(results_id1.intersection(results_id2))

def test_twice_the_same_next_page(self):
Expand Down Expand Up @@ -161,7 +161,7 @@ def setUp(self):

self.resource.known_fields = ['status', 'unread', 'title']
self.record = {
'_id': 1, 'status': 2, 'unread': True,
'id': 1, 'status': 2, 'unread': True,
'last_modified': 1234, 'title': 'Title'
}

Expand Down
8 changes: 4 additions & 4 deletions readinglist/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_get_all_handle_limit(self):
def test_get_all_handle_a_pagination_rules(self):
for x in range(10):
record = dict(self.record)
record['_id'] = x
record['id'] = x
record["number"] = x % 3
self.backend.create(self.resource, self.user_id, record)

Expand All @@ -187,14 +187,14 @@ def test_get_all_handle_a_pagination_rules(self):
def test_get_all_handle_all_pagination_rules(self):
for x in range(10):
record = dict(self.record)
record['_id'] = x
record["number"] = x % 3
self.backend.create(self.resource, self.user_id, record)
last_record = self.backend.create(self.resource, self.user_id,
record)

records, total_records = self.backend.get_all(
self.resource, self.user_id, pagination_rules=[
[('number', 1, utils.COMPARISON.GT)],
[('_id', 3, utils.COMPARISON.EQ)]
[('id', last_record['id'], utils.COMPARISON.EQ)]

])
self.assertEqual(total_records, 10)
Expand Down

0 comments on commit 31e2a22

Please sign in to comment.