Merge lp:~gesha/linaro-ci-dashboard/detail-view-tests-update into lp:linaro-ci-dashboard

Proposed by Georgy Redkozubov
Status: Merged
Approved by: Milo Casagrande
Approved revision: 23
Merged at revision: 24
Proposed branch: lp:~gesha/linaro-ci-dashboard/detail-view-tests-update
Merge into: lp:linaro-ci-dashboard
Diff against target: 65 lines (+33/-2)
1 file modified
dashboard/frontend/android_build/tests/test_android_build_clientresponse.py (+33/-2)
To merge this branch: bzr merge lp:~gesha/linaro-ci-dashboard/detail-view-tests-update
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+120506@code.launchpad.net

Description of the change

Added client response test for detail view page.
Fixed Milo's test that passed in "false-positive" way.

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

Hey gesha! Thanks for fixing this and for the new test.
Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dashboard/frontend/android_build/tests/test_android_build_clientresponse.py'
2--- dashboard/frontend/android_build/tests/test_android_build_clientresponse.py 2012-08-17 14:20:47 +0000
3+++ dashboard/frontend/android_build/tests/test_android_build_clientresponse.py 2012-08-21 06:59:19 +0000
4@@ -14,6 +14,7 @@
5 #
6 # You should have received a copy of the GNU Affero General Public License
7 # along with linaro-ci-dashboard. If not, see <http://www.gnu.org/licenses/>.
8+import urlparse
9
10 from frontend.tests.test_clientresponse import ClientResponseTestsGeneral
11
12@@ -24,6 +25,13 @@
13 super(AndroidBuildClientResponseTests, self).setUp()
14 self.android_build_data = {"name" : "a-build",
15 "build_type" : "build-android",
16+ "manifest_repo" : "repo",
17+ "manifest_branch" : "branch",
18+ "manifest_filename" : "filename",
19+ "make_jobs" : "2",
20+ "ramdisk_size" : "2",
21+ "binutils_version" : "1",
22+ "gcc_version" : "1"
23 }
24
25 def test_android_build_create_get(self):
26@@ -51,13 +59,36 @@
27 self.android_build_data, follow=True)
28 # Assert response code.
29 self.assertEquals(response.status_code, 200)
30+ # Assert content for required fields filled
31+ self.assertNotIn("This field is required", response.content)
32 # Assert template names for detail page.
33 template_names = [template.name for template in
34 response.templates]
35- self.assertEquals(template_names, ["android_loop_create.html",
36+ self.assertEquals(template_names, ["android_loop_detail.html",
37 "base.html",
38 "login.html",
39 ])
40 # Assert if everything is present on detail page.
41 self.assertIn(self.android_build_data["name"], response.content)
42- self.assertIn(self.android_build_data["build_type"], response.content)
43\ No newline at end of file
44+ self.assertIn(self.android_build_data["build_type"], response.content)
45+
46+ def test_android_build_detail_get(self):
47+ self.client.login(username=self.user, password=self.passwd)
48+
49+ # Follow redirect after save.
50+ target_file = "/android/create/"
51+ url = urlparse.urljoin("http://testserver/", target_file)
52+ response = self.client.post(url, self.android_build_data, follow=True)
53+ # Assert response code.
54+ self.assertEquals(response.status_code, 200)
55+ # Assert content for required fields filled
56+ self.assertNotIn("This field is required", response.content)
57+
58+ target_file = "/android/detail/%s/" % self.android_build_data["name"]
59+ url = urlparse.urljoin("http://testserver/", target_file)
60+ response = self.client.get(url, follow=True)
61+ # Assert response code.
62+ self.assertEquals(response.status_code, 200)
63+ self.assertIn("Details", response.content)
64+ self.assertIn("Build type", response.content)
65+

Subscribers

People subscribed via source and target branches