'Scenario: User can view all notes by associated tags.
Given I have a course with 5 notes and I am viewing the Notes page
When I switch to the "Tags" view
Then I see 4 tag groups
And I see correct content in the notes and groups
And an event has fired indicating that the Tags view was selected'

def test_tags_view(self):

    self._add_default_notes()
    self.notes_page.visit().switch_to_tab('tags')
    notes = self.notes_page.notes
    groups = self.notes_page.tag_groups
    self.assertEqual(len(notes), 7)
    self.assertEqual(len(groups), 4)
    self.assertGroupContent(groups[0], title=u'cool    (2)', notes=[u'Third    note', None])
    self.assertNoteContent(notes[0], 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[1], quote=u'Annotate    this', unit_name='Test    Unit    2', time_updated='Jan    01,    2012    at    01:01    UTC', tags=['Review', 'cool'])
    self.assertGroupContent(groups[1], title=u'review    (2)', notes=[u'Fourth    note', None])
    self.assertNoteContent(notes[2], text=u'Fourth    note', unit_name='Test    Unit    3', time_updated='Jan    01,    2014    at    01:01    UTC', tags=['review'])
    self.assertNoteContent(notes[3], quote=u'Annotate    this', unit_name='Test    Unit    2', time_updated='Jan    01,    2012    at    01:01    UTC', tags=['Review', 'cool'])
    self.assertGroupContent(groups[2], title=u'todo    (1)', notes=['Third    note'])
    self.assertNoteContent(notes[4], 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.assertGroupContent(groups[3], title=u'[no    tags]    (2)', notes=['Fifth    note', 'First    note'])
    self.assertNoteContent(notes[5], 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[6], 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('Tags')
