Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…dex order
  • Loading branch information...
commit 0982583736c66f1c340f80759d5f335f95ce0ff0 1 parent 26f7ea7
Les Orchard authored July 25, 2010
27  index.yaml
... ...
@@ -1,5 +1,20 @@
1 1
 indexes:
2 2
 
  3
+# AUTOGENERATED
  4
+
  5
+# This index.yaml is automatically updated whenever the dev_appserver
  6
+# detects that a new type of query is run.  If you want to manage the
  7
+# index.yaml file manually, remove the above marker line (the line
  8
+# saying "# AUTOGENERATED").  If you want to manage some indexes
  9
+# manually, move them above the marker line.  The index.yaml file is
  10
+# automatically uploaded to the admin console when you next deploy
  11
+# your application using appcfg.py.
  12
+
  13
+- kind: WBO
  14
+  ancestor: yes
  15
+  properties:
  16
+  - name: modified
  17
+
3 18
 - kind: WBO
4 19
   ancestor: yes
5 20
   properties:
@@ -10,6 +25,8 @@ indexes:
10 25
   ancestor: yes
11 26
   properties:
12 27
   - name: modified
  28
+  - name: sortindex
  29
+    direction: desc
13 30
 
14 31
 - kind: WBO
15 32
   ancestor: yes
@@ -33,13 +50,3 @@ indexes:
33 50
   properties:
34 51
   - name: wbo_id
35 52
   - name: sortindex
36  
-
37  
-# AUTOGENERATED
38  
-
39  
-# This index.yaml is automatically updated whenever the dev_appserver
40  
-# detects that a new type of query is run.  If you want to manage the
41  
-# index.yaml file manually, remove the above marker line (the line
42  
-# saying "# AUTOGENERATED").  If you want to manage some indexes
43  
-# manually, move them above the marker line.  The index.yaml file is
44  
-# automatically uploaded to the admin console when you next deploy
45  
-# your application using appcfg.py.
6  test/sync_api_tests.py
@@ -523,7 +523,7 @@ def test_retrieval_with_sort(self):
523 523
         sorts = {
524 524
             'oldest': lambda a,b: cmp(a.modified,  b.modified),
525 525
             'newest': lambda a,b: cmp(b.modified,  a.modified),
526  
-            'index':  lambda a,b: cmp(a.sortindex, b.sortindex),
  526
+            'index':  lambda a,b: cmp(b.sortindex, a.sortindex),
527 527
         }
528 528
 
529 529
         for sort_option, sort_fn in sorts.items():
@@ -581,11 +581,12 @@ def test_retrieval_by_multiple_criteria(self):
581 581
         predecessorid = 'b3'
582 582
 
583 583
         expected_ids = []
  584
+        wbos.sort(lambda b,a: cmp(a.sortindex, b.sortindex))
584 585
         for w in wbos:
585 586
             if (index_above < w.sortindex and index_below > w.sortindex and
586 587
                     parentid == w.parentid and predecessorid == w.predecessorid):
587 588
                 expected_ids.append(w.wbo_id)
588  
-        
  589
+         
589 590
         # Build and run a retrieval query using all of the criteria.
590 591
         params = 'index_above=%s&index_below=%s&parentid=%s&predecessorid=%s' % (
591 592
             index_above, index_below, parentid, predecessorid
@@ -654,6 +655,7 @@ def test_alternate_output_formats(self):
654 655
         (p, c, ah) = (self.profile, self.collection, self.auth_header)
655 656
         self.build_wbo_set()
656 657
         wbos = [ w for w in WBO.all() ]
  658
+        wbos.sort(lambda b,a: cmp(a.sortindex, b.sortindex))
657 659
         expected_ids = [ w.wbo_id for w in wbos ]
658 660
 
659 661
         url = '/sync/1.0/%s/storage/%s?full=1' % (p.user_name, c.name)

0 notes on commit 0982583

Please sign in to comment.
Something went wrong with that request. Please try again.