'Scenario: Bookmark unit button toggles correctly
Given that I am a registered user
And I visit my courseware page
For first 2 units
I visit the unit
And I can see the Bookmark button
When I click on Bookmark button
Then unit should be bookmarked
Then I click again on the bookmark button
And I should see a unit un-bookmarked'

def test_bookmark_button(self):

    self.setup_test()
    for index in range(2):
        self.course_home_page.visit()
        self.course_home_page.outline.go_to_section('TestSection{}'.format(index), 'TestSubsection{}'.format(index))
        self._toggle_bookmark_and_verify(True, 'bookmarked', 1)
        self.course_home_page.visit()
        self.course_home_page.outline.go_to_section('TestSection{}'.format(index), 'TestSubsection{}'.format(index))
        self._toggle_bookmark_and_verify(False, '', 0)
