Merge lp:~mhall119/summit/fix-test-site_root into lp:summit

Proposed by Michael Hall
Status: Merged
Approved by: James Westby
Approved revision: 178
Merged at revision: 178
Proposed branch: lp:~mhall119/summit/fix-test-site_root
Merge into: lp:summit
Diff against target: 38 lines (+4/-3)
1 file modified
summit/schedule/tests.py (+4/-3)
To merge this branch: bzr merge lp:~mhall119/summit/fix-test-site_root
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Nigel Babu (community) Approve
Review via email: mp+75862@code.launchpad.net

Commit message

Fix tests that were looking for a hard-coded SITE_ROOT in urls

Description of the change

If you have changed the SITE_ROOT setting in your local_setting.py, it will cause tests to fail as they are looking specifically for http://summit.ubuntu.com. This changes those test cases to look for the proper SITE_ROOT setting to be used in URLs.

To post a comment you must log in.
Revision history for this message
Nigel Babu (nigelbabu) wrote :

Good one!

review: Approve
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/schedule/tests.py'
2--- summit/schedule/tests.py 2011-09-16 18:40:15 +0000
3+++ summit/schedule/tests.py 2011-09-17 18:16:16 +0000
4@@ -34,6 +34,7 @@
5 # class directly.
6 factory.default_mapping[NameField] = str
7
8+site_root = getattr(settings, 'SITE_ROOT', 'http://summit.ubuntu.com')
9
10 class RescheduleCommandTestCase(unittest.TestCase):
11 """Tests for the 'reschedule' management command."""
12@@ -153,7 +154,7 @@
13
14 response = self.client.get('/uds-test.ical')
15 self.assertEquals(response.status_code, 200)
16- self.assertContains(response, 'URL:http://summit.ubuntu.com/uds-test/meeting/%s/-/\n' % meeting.id, 1)
17+ self.assertContains(response, 'URL:%s/uds-test/meeting/%s/-/\n' % (site_root, meeting.id), 1)
18
19 def test_ical_meeting_name_with_period(self):
20 """ Tests that ical doesn't break for nameless meetings"""
21@@ -177,7 +178,7 @@
22
23 response = self.client.get('/uds-test.ical')
24 self.assertEquals(response.status_code, 200)
25- self.assertContains(response, 'URL:http://summit.ubuntu.com/uds-test/meeting/%s/test.name/' % meeting.id, 1)
26+ self.assertContains(response, 'URL:%s/uds-test/meeting/%s/test.name/' % (site_root, meeting.id), 1)
27
28 class MeetingPageTestCase(djangotest.TestCase):
29
30@@ -214,7 +215,7 @@
31 # check meeting in ical
32 response = self.client.get('/uds-test.ical')
33 self.assertEquals(response.status_code, 200)
34- self.assertContains(response, 'URL:http://summit.ubuntu.com/uds-test/meeting/%s/test-meeting/' % meeting.id, 1)
35+ self.assertContains(response, 'URL:%s/uds-test/meeting/%s/test-meeting/' % (site_root, meeting.id), 1)
36
37
38 class ReverseUrlLookupTestCase(djangotest.TestCase):

Subscribers

People subscribed via source and target branches