Merge lp:~cjohnston/qa-dashboard/fi-idle-test into lp:qa-dashboard

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 609
Merged at revision: 609
Proposed branch: lp:~cjohnston/qa-dashboard/fi-idle-test
Merge into: lp:qa-dashboard
Diff against target: 60 lines (+7/-18)
2 files modified
idle_power/tests.py (+2/-14)
idle_power/views.py (+5/-4)
To merge this branch: bzr merge lp:~cjohnston/qa-dashboard/fi-idle-test
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+187143@code.launchpad.net

Commit message

Fix idle power arch overview so that the no arch url test doesn't fail

Description of the change

Currently the no arch idle power arch overview test isn't playing nicely, and fails in some situations. This will make things play better.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:609
http://s-jenkins:8080/job/dashboard-ci/178/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins:8080/job/dashboard-ci/178/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'idle_power/tests.py'
2--- idle_power/tests.py 2013-06-11 03:19:23 +0000
3+++ idle_power/tests.py 2013-09-24 03:25:54 +0000
4@@ -88,21 +88,9 @@
5
6 def test_no_arch_overview(self):
7 response = self.c.get(reverse('idle_power_arch', ))
8- rev_args = [self.image3861.arch, ]
9- redirect_url = reverse(
10- 'idle_power_arch_overview',
11- args=rev_args,
12- )
13- self.assertEqual(response.status_code, 302)
14- self.assertRedirects(
15+ self.assertEqual(response.status_code, 200)
16+ self.assertTemplateUsed(
17 response,
18- redirect_url,
19- )
20- redirect_response = self.c.get(redirect_url)
21- # Verify that the page redirects to an arch
22- self.assertEqual(redirect_response.status_code, 200)
23- self.assertTemplateUsed(
24- redirect_response,
25 'idle_power/arch_overview.html',
26 )
27
28
29=== modified file 'idle_power/views.py'
30--- idle_power/views.py 2013-05-21 16:00:12 +0000
31+++ idle_power/views.py 2013-09-24 03:25:54 +0000
32@@ -20,7 +20,6 @@
33 from django.shortcuts import (
34 render_to_response,
35 get_object_or_404,
36- redirect,
37 )
38
39 from django_tables2 import RequestConfig
40@@ -55,6 +54,7 @@
41 'machine__id',
42 ).distinct()
43 arches = [x['image__arch'] for x in vals]
44+ arches = sorted(arches)
45 testcases = set(
46 [x['testcase'] for x in vals if not arch or x['image__arch'] == arch]
47 )
48@@ -62,9 +62,10 @@
49 chart_size = request.GET.get('size', '')
50
51 if arch is None:
52- return redirect(
53- 'arch/{}/'.format(arches[0] if len(arches) > 0 else "amd64")
54- )
55+ if len(arches) > 0:
56+ arch = arches[0]
57+ else:
58+ arch = "UNKNOWN"
59
60 result = vals.filter(image__arch=arch).distinct('machine__name')
61

Subscribers

People subscribed via source and target branches