'Scenario: Admins should be able to give course ownership to someone else
Given I have opened a new course in Studio
And I am viewing the course team settings
When I add other user to the course team
And I make other user a course team admin
When I remove admin rights from myself
Then I should not be marked as an admin
And I cannot manage users
And I cannot make myself a course team admin
When other user logs in
And he selects the new course
And he views the course team settings
And he deletes me from the course team
And I am logged into studio
Then I do not see the course on my page'

def test_admins_should_be_able_to_give_course_ownership_to_someone_else(self):

    self.page.add_user_to_course(self.other_user.get('email'))
    self._assert_user_present(self.other_user, present=True)
    current = self.page.get_user(self.user.get('email'))
    self.assertFalse(current.can_demote)
    self.assertFalse(current.can_delete)
    self.assertIn('Promote    another    member    to    Admin    to    remove    your    admin    rights', current.no_change_warning_text)
    other = self.page.get_user(self.other_user.get('email'))
    other.click_promote()
    self._refresh_page()
    other = self.page.get_user(self.other_user.get('email'))
    self._assert_is_admin(other)
    current = self.page.get_user(self.user.get('email'))
    self.assertTrue(current.can_demote)
    self.assertTrue(current.can_delete)
    current.click_demote()
    self._refresh_page()
    current = self.page.get_user(self.user.get('email'))
    self._assert_is_staff(current, can_manage=False)
    self._assert_can_not_manage_users()
    self.assertFalse(current.can_promote)
    self.log_in(self.other_user)
    self._go_to_course_team_page()
    current = self.page.get_user(self.user.get('email'))
    current.click_delete()
    self._refresh_page()
    self._assert_user_present(self.user, present=False)
    self.log_in(self.user)
    self._assert_current_course(visible=False)
