'Scenario: User can view all notes by location in Course.
Given I have a course with 5 notes
When I open Notes page
And I switch to "Location in Course" view
Then I see 2 groups, 3 sections and 5 notes
And I see correct content in the notes and groups
And an event has fired indicating that the Location in Course view was selected'

def test_course_structure_view(self):

    self._add_default_notes()
    self.notes_page.visit().switch_to_tab('structure')
    notes = self.notes_page.notes
    groups = self.notes_page.chapter_groups
    sections = self.notes_page.subsection_groups
    self.assertEqual(len(notes), 5)
    self.assertEqual(len(groups), 2)
    self.assertEqual(len(sections), 3)
    self.assertChapterContent(groups[0], title=u'Test    Section    1', subtitles=[u'Test    Subsection    1', u'Test    Subsection    2'])
    self.assertGroupContent(sections[0], title=u'Test    Subsection    1', notes=[u'Fifth    note', u'Third    note', None])
    self.assertNoteContent(notes[0], quote=u'Annotate    this', text=u'Fifth    note', unit_name='Test    Unit    1', time_updated='Jan    01,    2015    at    01:01    UTC')
    self.assertNoteContent(notes[1], quote=u'Annotate    this', text=u'Third    note', unit_name='Test    Unit    1', time_updated='Jan    01,    2013    at    01:01    UTC', tags=['Cool', 'TODO'])
    self.assertNoteContent(notes[2], quote=u'Annotate    this', unit_name='Test    Unit    2', time_updated='Jan    01,    2012    at    01:01    UTC', tags=['Review', 'cool'])
    self.assertGroupContent(sections[1], title=u'Test    Subsection    2', notes=[u'Fourth    note'])
    self.assertNoteContent(notes[3], text=u'Fourth    note', unit_name='Test    Unit    3', time_updated='Jan    01,    2014    at    01:01    UTC', tags=['review'])
    self.assertChapterContent(groups[1], title=u'Test    Section    2', subtitles=[u'Test    Subsection    3'])
    self.assertGroupContent(sections[2], title=u'Test    Subsection    3', notes=[u'First    note'])
    self.assertNoteContent(notes[4], quote=u'Annotate    this', text=u'First    note', unit_name='Test    Unit    4', time_updated='Jan    01,    2011    at    01:01    UTC')
    self.assert_viewed_event('Location    in    Course')
