Permalink
Browse files

Added a missing index; tweaked tests to account for descending sortin…

…dex order
  • Loading branch information...
1 parent 26f7ea7 commit 0982583736c66f1c340f80759d5f335f95ce0ff0 @lmorchard committed Jul 25, 2010
Showing with 21 additions and 12 deletions.
  1. +17 −10 index.yaml
  2. +4 −2 test/sync_api_tests.py
View
@@ -1,5 +1,20 @@
indexes:
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run. If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED"). If you want to manage some indexes
+# manually, move them above the marker line. The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.
+
+- kind: WBO
+ ancestor: yes
+ properties:
+ - name: modified
+
- kind: WBO
ancestor: yes
properties:
@@ -10,6 +25,8 @@ indexes:
ancestor: yes
properties:
- name: modified
+ - name: sortindex
+ direction: desc
- kind: WBO
ancestor: yes
@@ -33,13 +50,3 @@ indexes:
properties:
- name: wbo_id
- name: sortindex
-
-# AUTOGENERATED
-
-# This index.yaml is automatically updated whenever the dev_appserver
-# detects that a new type of query is run. If you want to manage the
-# index.yaml file manually, remove the above marker line (the line
-# saying "# AUTOGENERATED"). If you want to manage some indexes
-# manually, move them above the marker line. The index.yaml file is
-# automatically uploaded to the admin console when you next deploy
-# your application using appcfg.py.
View
@@ -523,7 +523,7 @@ def test_retrieval_with_sort(self):
sorts = {
'oldest': lambda a,b: cmp(a.modified, b.modified),
'newest': lambda a,b: cmp(b.modified, a.modified),
- 'index': lambda a,b: cmp(a.sortindex, b.sortindex),
+ 'index': lambda a,b: cmp(b.sortindex, a.sortindex),
}
for sort_option, sort_fn in sorts.items():
@@ -581,11 +581,12 @@ def test_retrieval_by_multiple_criteria(self):
predecessorid = 'b3'
expected_ids = []
+ wbos.sort(lambda b,a: cmp(a.sortindex, b.sortindex))
for w in wbos:
if (index_above < w.sortindex and index_below > w.sortindex and
parentid == w.parentid and predecessorid == w.predecessorid):
expected_ids.append(w.wbo_id)
-
+
# Build and run a retrieval query using all of the criteria.
params = 'index_above=%s&index_below=%s&parentid=%s&predecessorid=%s' % (
index_above, index_below, parentid, predecessorid
@@ -654,6 +655,7 @@ def test_alternate_output_formats(self):
(p, c, ah) = (self.profile, self.collection, self.auth_header)
self.build_wbo_set()
wbos = [ w for w in WBO.all() ]
+ wbos.sort(lambda b,a: cmp(a.sortindex, b.sortindex))
expected_ids = [ w.wbo_id for w in wbos ]
url = '/sync/1.0/%s/storage/%s?full=1' % (p.user_name, c.name)

0 comments on commit 0982583

Please sign in to comment.