Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/bug_689334'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pike committed Sep 27, 2011
2 parents 014f2e2 + 5e81440 commit 6a68839
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/shipping/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def signoff_actions(locales=None, appversions=None, chunks=100):
# now we know which locales to check for this version, go for Actions
actions = (Action.objects
.filter(signoff__appversion=appversion)
.order_by('-id')
.order_by('-signoff__id', '-id')
.values_list('id',
'flag',
'signoff_id',
Expand Down
59 changes: 59 additions & 0 deletions apps/shipping/fixtures/signoffs.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"username": "localizer_fr"
}
},
{
"pk": 5,
"model": "auth.user",
"fields": {
"username": "localizer_da"
}
},
{
"pk": 1,
"model": "life.tree",
Expand Down Expand Up @@ -87,6 +94,28 @@
"locale": ["fr"]
}
},
{
"pk": 4,
"model": "shipping.signoff",
"fields": {
"push": ["l10n/da", "l10n da 0003"],
"appversion": ["fx1.0"],
"author": 5,
"when": "2000-01-05 18:00",
"locale": ["da"]
}
},
{
"pk": 5,
"model": "shipping.signoff",
"fields": {
"push": ["l10n/da", "l10n da 0004"],
"appversion": ["fx1.0"],
"author": 5,
"when": "2000-01-06 18:00",
"locale": ["da"]
}
},
{
"pk": 1,
"model": "shipping.action",
Expand Down Expand Up @@ -137,5 +166,35 @@
"comment": "rejecting this sign-off",
"when": "2000-01-07 00:01"
}
},
{
"pk": 6,
"model": "shipping.action",
"fields": {
"signoff": 4,
"flag": 0,
"author": 5,
"when": "2000-01-05 18:00"
}
},
{
"pk": 7,
"model": "shipping.action",
"fields": {
"signoff": 5,
"flag": 0,
"author": 5,
"when": "2000-01-06 18:00"
}
},
{
"pk": 8,
"model": "shipping.action",
"fields": {
"signoff": 4,
"flag": 1,
"author": 1,
"when": "2000-01-07 12:00"
}
}
]
22 changes: 22 additions & 0 deletions apps/shipping/fixtures/test_pushes.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,27 @@
"push_date": "2000-01-05 00:00",
"push_id": 1
}
},
{
"pk": 8,
"model": "life.push",
"fields": {
"repository": ["l10n/da"],
"changesets": [["l10n da 0002"],["l10n da 0003"]],
"user": "da@ldap.l10n.tld",
"push_date": "2000-01-05 01:00",
"push_id": 1
}
},
{
"pk": 9,
"model": "life.push",
"fields": {
"repository": ["l10n/da"],
"changesets": [["l10n da 0004"]],
"user": "da@ldap.l10n.tld",
"push_date": "2000-01-06 00:00",
"push_id": 2
}
}
]
56 changes: 56 additions & 0 deletions apps/shipping/fixtures/test_repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
"code": "fr"
}
},
{
"pk": 4,
"model": "life.locale",
"fields": {
"code": "da"
}
},
{
"pk": 2,
"model": "life.changeset",
Expand Down Expand Up @@ -119,6 +126,39 @@
"parents": [["l10n fr 0002"]]
}
},
{
"pk": 11,
"model": "life.changeset",
"fields": {
"revision": "l10n da 0002",
"user": "danish localizer",
"description": "first da commit",
"files": [],
"parents": [["000000000000"]]
}
},
{
"pk": 12,
"model": "life.changeset",
"fields": {
"revision": "l10n da 0003",
"user": "danish localizer",
"description": "second da commit",
"files": [],
"parents": [["l10n da 0002"]]
}
},
{
"pk": 13,
"model": "life.changeset",
"fields": {
"revision": "l10n da 0004",
"user": "danish localizer",
"description": "third da commit",
"files": [],
"parents": [["l10n da 0003"]]
}
},
{
"pk": 1,
"model": "life.forest",
Expand Down Expand Up @@ -186,5 +226,21 @@
"name": "l10n/fr",
"forest": ["l10n"]
}
},
{
"pk": 5,
"model": "life.repository",
"fields": {
"url": "http://localhost:8001/l10n/da/",
"locale": ["da"],
"changesets": [
["000000000000"],
["l10n da 0002"],
["l10n da 0003"],
["l10n da 0004"]
],
"name": "l10n/da",
"forest": ["l10n"]
}
}
]
41 changes: 28 additions & 13 deletions apps/shipping/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ class ApiActionTest(TestCase):

def test_count(self):
"""Test that we have the right amount of Signoffs and Actions"""
eq_(Signoff.objects.count(), 3)
eq_(Action.objects.count(), 5)
eq_(Signoff.objects.count(), 5)
eq_(Action.objects.count(), 8)

def test_accepted(self):
"""Test for the german accepted signoff"""
Expand Down Expand Up @@ -373,9 +373,12 @@ def test_rejected(self):
eq_(so.action_set.count(), 2)

def test_getlist(self):
"""Test that the list returns on accepted and one pending signoff."""
"""Test that the list returns the right flags."""
flags = flag_lists(appversions={"code": "fx1.0"})
eq_(flags, {("fx", "pl"): [0], ("fx", "de"): [1], ("fx", "fr"): [2]})
eq_(flags, {("fx", "pl"): [0],
("fx", "de"): [1],
("fx", "fr"): [2],
("fx", "da"): [1, 0]})


class SignOffTest(TestCase, EmbedsTestCaseMixin):
Expand All @@ -390,7 +393,8 @@ def test_l10n_changesets(self):
url += '?av=fx1.0'
response = self.client.get(url)
eq_(response.status_code, 200)
eq_(response.content, """de l10n de 0002
eq_(response.content, """da l10n da 0003
de l10n de 0002
""")

def test_shipped_locales(self):
Expand All @@ -399,7 +403,8 @@ def test_shipped_locales(self):
url += '?av=fx1.0'
response = self.client.get(url)
eq_(response.status_code, 200)
eq_(response.content, """de
eq_(response.content, """da
de
en-US
""")

Expand All @@ -412,7 +417,7 @@ def test_signoff_json(self):
data = json.loads(response.content)
ok_('items' in data)
items = data['items']
eq_(len(items), 4)
eq_(len(items), 5)
sos = {}
avt = None
for item in items:
Expand All @@ -424,6 +429,11 @@ def test_signoff_json(self):
eq_(item, None)
eq_(avt['appversion'], 'fx1.0')
eq_(avt['label'], 'fx')
ok_('fx/da' in sos)
so = sos['fx/da']
eq_(so['signoff'], ['accepted', 'pending'])
eq_(so['apploc'], 'fx::da')
eq_(so['tree'], 'fx')
ok_('fx/de' in sos)
so = sos['fx/de']
eq_(so['signoff'], ['accepted'])
Expand Down Expand Up @@ -464,30 +474,35 @@ def test_ship_milestone(self):
eq_(response.status_code, 302)
mile = self.av.milestone_set.all()[0] # refresh mile from the db
eq_(mile.status, Milestone.SHIPPED)
eq_(mile.signoffs.count(), 1)
eq_(mile.signoffs.count(), 2)
# now that it's shipped, it should error to ship again
response = self.client.post(ship, {'ms': mile.code})
eq_(response.status_code, 403)
# verify l10n-changesets and json, and shipped-locales
url = reverse('shipping.views.status.l10n_changesets')
response = self.client.get(url, {'ms': mile.code})
eq_(response.status_code, 200)
eq_(response.content, "de l10n de 0002\n")
eq_(response.content, "da l10n da 0003\nde l10n de 0002\n")
url = reverse('shipping.views.milestone.json_changesets')
response = self.client.get(url, {'ms': mile.code,
'platforms': 'windows, linux'})
eq_(response.status_code, 200)
json_changes = json.loads(response.content)
eq_(json_changes, {'de':
{
'revision': 'l10n de 0002',
{
'revision': 'l10n de 0002',
'platforms': ['windows', 'linux']
},
'da':
{
'revision': 'l10n da 0003',
'platforms': ['windows', 'linux']
}
}
})
url = reverse('shipping.views.status.shipped_locales')
response = self.client.get(url, {'ms': mile.code})
eq_(response.status_code, 200)
eq_(response.content, "de\nen-US\n")
eq_(response.content, "da\nde\nen-US\n")


def test_dashboard_static_files(self):
Expand Down

0 comments on commit 6a68839

Please sign in to comment.