Skip to content
This repository
Browse code

bug 689334, signoff view forgets pending signoff if older one is appr…

…oved, r=peterbe
  • Loading branch information...
commit 5e81440dd3427c2a997fb7861fb2c0784022cde5 1 parent 014f2e2
Axel Hecht authored September 27, 2011
2  apps/shipping/api.py
@@ -66,7 +66,7 @@ def signoff_actions(locales=None, appversions=None, chunks=100):
66 66
         # now we know which locales to check for this version, go for Actions
67 67
         actions = (Action.objects
68 68
                    .filter(signoff__appversion=appversion)
69  
-                   .order_by('-id')
  69
+                   .order_by('-signoff__id', '-id')
70 70
                    .values_list('id',
71 71
                                 'flag',
72 72
                                 'signoff_id',
59  apps/shipping/fixtures/signoffs.json
@@ -28,6 +28,13 @@
28 28
     }
29 29
   },
30 30
   {
  31
+    "pk": 5,
  32
+    "model": "auth.user",
  33
+    "fields": {
  34
+      "username": "localizer_da"
  35
+    }
  36
+  },
  37
+  {
31 38
     "pk": 1,
32 39
     "model": "life.tree",
33 40
     "fields": {
@@ -88,6 +95,28 @@
88 95
     }
89 96
   },
90 97
   {
  98
+    "pk": 4,
  99
+    "model": "shipping.signoff",
  100
+    "fields": {
  101
+      "push": ["l10n/da", "l10n da 0003"],
  102
+      "appversion": ["fx1.0"],
  103
+      "author": 5,
  104
+      "when": "2000-01-05 18:00",
  105
+      "locale": ["da"]
  106
+    }
  107
+  },
  108
+  {
  109
+    "pk": 5,
  110
+    "model": "shipping.signoff",
  111
+    "fields": {
  112
+      "push": ["l10n/da", "l10n da 0004"],
  113
+      "appversion": ["fx1.0"],
  114
+      "author": 5,
  115
+      "when": "2000-01-06 18:00",
  116
+      "locale": ["da"]
  117
+    }
  118
+  },
  119
+  {
91 120
     "pk": 1,
92 121
     "model": "shipping.action",
93 122
     "fields": {
@@ -137,5 +166,35 @@
137 166
       "comment": "rejecting this sign-off",
138 167
       "when": "2000-01-07 00:01"
139 168
     }
  169
+  },
  170
+  {
  171
+    "pk": 6,
  172
+    "model": "shipping.action",
  173
+    "fields": {
  174
+      "signoff": 4,
  175
+      "flag": 0,
  176
+      "author": 5,
  177
+      "when": "2000-01-05 18:00"
  178
+    }
  179
+  },
  180
+  {
  181
+    "pk": 7,
  182
+    "model": "shipping.action",
  183
+    "fields": {
  184
+      "signoff": 5,
  185
+      "flag": 0,
  186
+      "author": 5,
  187
+      "when": "2000-01-06 18:00"
  188
+    }
  189
+  },
  190
+  {
  191
+    "pk": 8,
  192
+    "model": "shipping.action",
  193
+    "fields": {
  194
+      "signoff": 4,
  195
+      "flag": 1,
  196
+      "author": 1,
  197
+      "when": "2000-01-07 12:00"
  198
+    }
140 199
   }
141 200
 ]
22  apps/shipping/fixtures/test_pushes.json
@@ -75,5 +75,27 @@
75 75
       "push_date": "2000-01-05 00:00",
76 76
       "push_id": 1
77 77
     }
  78
+  },
  79
+  {
  80
+    "pk": 8,
  81
+    "model": "life.push",
  82
+    "fields": {
  83
+      "repository": ["l10n/da"],
  84
+      "changesets": [["l10n da 0002"],["l10n da 0003"]],
  85
+      "user": "da@ldap.l10n.tld",
  86
+      "push_date": "2000-01-05 01:00",
  87
+      "push_id": 1
  88
+    }
  89
+  },
  90
+  {
  91
+    "pk": 9,
  92
+    "model": "life.push",
  93
+    "fields": {
  94
+      "repository": ["l10n/da"],
  95
+      "changesets": [["l10n da 0004"]],
  96
+      "user": "da@ldap.l10n.tld",
  97
+      "push_date": "2000-01-06 00:00",
  98
+      "push_id": 2
  99
+    }
78 100
   }
79 101
 ]
56  apps/shipping/fixtures/test_repos.json
@@ -21,6 +21,13 @@
21 21
     }
22 22
   },
23 23
   {
  24
+    "pk": 4,
  25
+    "model": "life.locale",
  26
+    "fields": {
  27
+      "code": "da"
  28
+    }
  29
+  },
  30
+  {
24 31
     "pk": 2,
25 32
     "model": "life.changeset",
26 33
     "fields": {
@@ -120,6 +127,39 @@
120 127
     }
121 128
   },
122 129
   {
  130
+    "pk": 11,
  131
+    "model": "life.changeset",
  132
+    "fields": {
  133
+      "revision": "l10n da 0002",
  134
+      "user": "danish localizer",
  135
+      "description": "first da commit",
  136
+      "files": [],
  137
+      "parents": [["000000000000"]]
  138
+    }
  139
+  },
  140
+  {
  141
+    "pk": 12,
  142
+    "model": "life.changeset",
  143
+    "fields": {
  144
+      "revision": "l10n da 0003",
  145
+      "user": "danish localizer",
  146
+      "description": "second da commit",
  147
+      "files": [],
  148
+      "parents": [["l10n da 0002"]]
  149
+    }
  150
+  },
  151
+  {
  152
+    "pk": 13,
  153
+    "model": "life.changeset",
  154
+    "fields": {
  155
+      "revision": "l10n da 0004",
  156
+      "user": "danish localizer",
  157
+      "description": "third da commit",
  158
+      "files": [],
  159
+      "parents": [["l10n da 0003"]]
  160
+    }
  161
+  },
  162
+  {
123 163
     "pk": 1, 
124 164
     "model": "life.forest", 
125 165
     "fields": {
@@ -186,5 +226,21 @@
186 226
       "name": "l10n/fr", 
187 227
       "forest": ["l10n"]
188 228
     }
  229
+  }, 
  230
+  {
  231
+    "pk": 5, 
  232
+    "model": "life.repository", 
  233
+    "fields": {
  234
+      "url": "http://localhost:8001/l10n/da/", 
  235
+      "locale": ["da"], 
  236
+      "changesets": [
  237
+        ["000000000000"],
  238
+	["l10n da 0002"],
  239
+	["l10n da 0003"],
  240
+	["l10n da 0004"]
  241
+      ], 
  242
+      "name": "l10n/da", 
  243
+      "forest": ["l10n"]
  244
+    }
189 245
   }
190 246
 ]
41  apps/shipping/tests.py
@@ -335,8 +335,8 @@ class ApiActionTest(TestCase):
335 335
 
336 336
     def test_count(self):
337 337
         """Test that we have the right amount of Signoffs and Actions"""
338  
-        eq_(Signoff.objects.count(), 3)
339  
-        eq_(Action.objects.count(), 5)
  338
+        eq_(Signoff.objects.count(), 5)
  339
+        eq_(Action.objects.count(), 8)
340 340
 
341 341
     def test_accepted(self):
342 342
         """Test for the german accepted signoff"""
@@ -373,9 +373,12 @@ def test_rejected(self):
373 373
         eq_(so.action_set.count(), 2)
374 374
 
375 375
     def test_getlist(self):
376  
-        """Test that the list returns on accepted and one pending signoff."""
  376
+        """Test that the list returns the right flags."""
377 377
         flags = flag_lists(appversions={"code": "fx1.0"})
378  
-        eq_(flags, {("fx", "pl"): [0], ("fx", "de"): [1], ("fx", "fr"): [2]})
  378
+        eq_(flags, {("fx", "pl"): [0],
  379
+                     ("fx", "de"): [1],
  380
+                     ("fx", "fr"): [2],
  381
+                     ("fx", "da"): [1, 0]})
379 382
 
380 383
 
381 384
 class SignOffTest(TestCase, EmbedsTestCaseMixin):
@@ -390,7 +393,8 @@ def test_l10n_changesets(self):
390 393
         url += '?av=fx1.0'
391 394
         response = self.client.get(url)
392 395
         eq_(response.status_code, 200)
393  
-        eq_(response.content, """de l10n de 0002
  396
+        eq_(response.content, """da l10n da 0003
  397
+de l10n de 0002
394 398
 """)
395 399
 
396 400
     def test_shipped_locales(self):
@@ -399,7 +403,8 @@ def test_shipped_locales(self):
399 403
         url += '?av=fx1.0'
400 404
         response = self.client.get(url)
401 405
         eq_(response.status_code, 200)
402  
-        eq_(response.content, """de
  406
+        eq_(response.content, """da
  407
+de
403 408
 en-US
404 409
 """)
405 410
 
@@ -412,7 +417,7 @@ def test_signoff_json(self):
412 417
         data = json.loads(response.content)
413 418
         ok_('items' in data)
414 419
         items = data['items']
415  
-        eq_(len(items), 4)
  420
+        eq_(len(items), 5)
416 421
         sos = {}
417 422
         avt = None
418 423
         for item in items:
@@ -424,6 +429,11 @@ def test_signoff_json(self):
424 429
                 eq_(item, None)
425 430
         eq_(avt['appversion'], 'fx1.0')
426 431
         eq_(avt['label'], 'fx')
  432
+        ok_('fx/da' in sos)
  433
+        so = sos['fx/da']
  434
+        eq_(so['signoff'], ['accepted', 'pending'])
  435
+        eq_(so['apploc'], 'fx::da')
  436
+        eq_(so['tree'], 'fx')
427 437
         ok_('fx/de' in sos)
428 438
         so = sos['fx/de']
429 439
         eq_(so['signoff'], ['accepted'])
@@ -464,7 +474,7 @@ def test_ship_milestone(self):
464 474
         eq_(response.status_code, 302)
465 475
         mile = self.av.milestone_set.all()[0]  # refresh mile from the db
466 476
         eq_(mile.status, Milestone.SHIPPED)
467  
-        eq_(mile.signoffs.count(), 1)
  477
+        eq_(mile.signoffs.count(), 2)
468 478
         # now that it's shipped, it should error to ship again
469 479
         response = self.client.post(ship, {'ms': mile.code})
470 480
         eq_(response.status_code, 403)
@@ -472,22 +482,27 @@ def test_ship_milestone(self):
472 482
         url = reverse('shipping.views.status.l10n_changesets')
473 483
         response = self.client.get(url, {'ms': mile.code})
474 484
         eq_(response.status_code, 200)
475  
-        eq_(response.content, "de l10n de 0002\n")
  485
+        eq_(response.content, "da l10n da 0003\nde l10n de 0002\n")
476 486
         url = reverse('shipping.views.milestone.json_changesets')
477 487
         response = self.client.get(url, {'ms': mile.code,
478 488
                                          'platforms': 'windows, linux'})
479 489
         eq_(response.status_code, 200)
480 490
         json_changes = json.loads(response.content)
481 491
         eq_(json_changes, {'de':
482  
-                           {
483  
-                               'revision': 'l10n de 0002',
  492
+                            {
  493
+                                'revision': 'l10n de 0002',
  494
+                                'platforms': ['windows', 'linux']
  495
+                            },
  496
+                            'da':
  497
+                            {
  498
+                               'revision': 'l10n da 0003',
484 499
                                'platforms': ['windows', 'linux']
485  
-                               }
  500
+                            }
486 501
                            })
487 502
         url = reverse('shipping.views.status.shipped_locales')
488 503
         response = self.client.get(url, {'ms': mile.code})
489 504
         eq_(response.status_code, 200)
490  
-        eq_(response.content, "de\nen-US\n")
  505
+        eq_(response.content, "da\nde\nen-US\n")
491 506
 
492 507
 
493 508
     def test_dashboard_static_files(self):

0 notes on commit 5e81440

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