from django.core.urlresolvers import reverse
from django_webtest import WebTest

class CourseSearchTests(WebTest):

    fixtures = ['fixtures/users.json', 'fixtures/courses.json']

    # Username should appear in top right corner
    def testUserLoggedIn(self):
        index = self.app.get('/', user='sustainability@pomona.edu')
        index.mustcontain('sustainability@pomona.edu')

    # Clicking 'Course Search' navigation tab should bring up page with title Course Search
    def testCourseSearchLink(self):
        index = self.app.get('/', user='sustainability@pomona.edu')
        course_search_index = index.click('Course Search')
        assert 'Course Search' in course_search_index

    def testSharingEmptySchedule(self):
        url = reverse("schedule")
        schedule_page = self.app.get(url, user='sustainability@pomona.edu')
        share_page_with_warning = schedule_page.click('share')
        assert 'There don\'t seem to be any courses in your schedule.' in share_page_with_warning

    def testSearchingForCourses(self):
        url = reverse("schedule")
        schedule_page = self.app.get(url, user='sustainability@pomona.edu')
        schedule_page.form['department'] = '1' # AISS department
        schedule_page_with_results = schedule_page.form.submit() # Go button
        assert 'AISS002ALKS-01' in schedule_page_with_results
        assert 'AISS002BLKS-01' in schedule_page_with_results

    def testFrozenPage(self):
        url = reverse("view_schedule", kwargs={'schedule_id': 1})
        frozen_schedule = self.app.get(url, user='sustainability@pomona.edu')
        assert 'ART 021' in frozen_schedule

    def testLoadForEditingOnFrozenPage(self):
        url = reverse("view_schedule", kwargs={'schedule_id': 1})
        frozen_schedule = self.app.get(url, user='sustainability@pomona.edu')
        unfrozen_schedule = frozen_schedule.form.submit().follow() # Load for editing button
        assert 'export to calendar' in unfrozen_schedule
        assert 'clear' in unfrozen_schedule
@@ -625,22 +625,23 @@
 'Course 
-Search
+Planner
 ')%0A     
@@ -658,22 +658,23 @@
 'Course 
-Search
+Planner
 ' in cou
@@ -750,32 +750,38 @@
  = reverse(%22
-schedule
+course_planner
 %22)%0A        s
@@ -1071,24 +1071,30 @@
 everse(%22
-schedule
+course_planner
 %22)%0A     
@@ -1960,19 +1960,15 @@
 ort 
-to calendar
+as .ics
 ' in

Fix tests for course planner