'Scenario: Locking and unlocking a subsection will not publish its draft units
Given I have a course with a subsection and unit
And the unit has a draft and published version
When I enable explicit staff lock on the subsection
And I disable explicit staff lock on the subsection
And I click the View Live button to switch to staff view
Then I see the published version of the unit'

def test_toggling_staff_lock_on_subsection_does_not_publish_draft_units(self):

    self.course_outline_page.visit()
    self.course_outline_page.expand_all_subsections()
    unit = self.course_outline_page.section_at(0).subsection_at(0).unit_at(0).go_to()
    add_discussion(unit)
    self.course_outline_page.visit()
    self.course_outline_page.expand_all_subsections()
    subsection = self.course_outline_page.section_at(0).subsection_at(0)
    subsection.set_staff_lock(True)
    subsection.set_staff_lock(False)
    unit = subsection.unit_at(0).go_to()
    unit.view_published_version()
    courseware = CoursewarePage(self.browser, self.course_id)
    courseware.wait_for_page()
    self.assertEqual(courseware.num_xblock_components, 0)
