'Given that I am a staff member
When I visit the LMS Courseware
Then I can see all gated subsections
Displayed along with notification banners
Then if I masquerade as a student
Then I cannot see a gated subsection
When I fufill the gating prerequisite
Then I can see the gated subsection (without a banner)'

def test_gated_subsection_in_lms_for_staff(self):

    self._setup_prereq()
    self._setup_gated_subsection()
    self._auto_auth(self.STUDENT_USERNAME, self.STUDENT_EMAIL, False)
    self.courseware_page.visit()
    self._fulfill_prerequisite()
    self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True)
    self.course_home_page.visit()
    self.assertEqual(self.course_home_page.preview.staff_view_mode, 'Staff')
    self.assertEqual(self.course_home_page.outline.num_subsections, 2)
    self.course_home_page.outline.go_to_section('Test    Section    1', 'Test    Subsection    2')
    self.courseware_page.wait_for_page()
    self.assertTrue(self.courseware_page.has_banner())
    self.course_home_page.visit()
    self.course_home_page.outline.go_to_section('Test    Section    1', 'Test    Subsection    1')
    self.courseware_page.wait_for_page()
    self.course_home_page.visit()
    self.course_home_page.preview.set_staff_view_mode('Learner')
    self.assertEqual(self.course_home_page.outline.num_subsections, 1)
    self.course_home_page.outline.go_to_section('Test    Section    1', 'Test    Subsection    1')
    self.courseware_page.wait_for_page()
    self.assertFalse(self.courseware_page.has_banner())
    self.course_home_page.visit()
    self.course_home_page.preview.set_staff_view_mode_specific_student(self.STUDENT_USERNAME)
    self.assertEqual(self.course_home_page.outline.num_subsections, 2)
    self.course_home_page.outline.go_to_section('Test    Section    1', 'Test    Subsection    2')
    self.courseware_page.wait_for_page()
    self.assertFalse(self.courseware_page.has_banner())
