def test_remove_users(self, test_case_id, test_user_id, test_univ_id, role, role_id, canvas_role, success_msg_ind, remove_list_ind, error_msg_ind, add_remove_ind): if add_remove_ind != 'remove': return test_univ_id = self.normalize_xlrd_number(test_univ_id, '{0:08d}') role_id = self.normalize_xlrd_number(role_id) self.start_message(test_user_id, test_univ_id, role, role_id) # Note: ICOMMONS_REST_API_HOST environment needs to match the LTI tool # environment (because of shared cache interactions) # ensure person is in course before attempting to remove using API # 1. remove ALL roles/enrollments for the test user in this course # to ensure no incidental data causes conflict when we try to add # 2. add via API the role we want to test removing through the UI self.api.remove_user( self.test_settings['test_course']['cid'], test_univ_id) self.api.add_user( self.test_settings['test_course']['cid'], test_univ_id, role_id) user_list_page = UserListPageObject(self.driver) # Note: the refresh has been added due to issues with remove. If # user is added via the api but the page isn't reload, the tests will # sporadically fail out with NoSuchElementException. self.driver.refresh() self.setUp() # Delete the user in Canvas user_list_page.delete_user(test_univ_id, role_id) self.assertTrue(user_list_page.is_loaded()) # Note: the refresh has been added due to issues with remove. If the # user has been deleted via the UI, but the page isn't reloaded, # it would sporadically fail out with an assertion error. We have # yet to find a more graceful solution. self.driver.refresh() self.setUp() # Assert that the deleted user does not appear in Manage People self.assertFalse( user_list_page.user_present_with_role(test_univ_id, role_id))
def test_remove_users(self, test_case_id, test_user_id, test_univ_id, role, role_id, canvas_role, success_msg_ind, remove_list_ind, error_msg_ind, add_remove_ind): if add_remove_ind != 'remove': return test_univ_id = self.normalize_xlrd_number(test_univ_id, '{0:08d}') role_id = self.normalize_xlrd_number(role_id) self.start_message(test_user_id, test_univ_id, role, role_id) # Note: ICOMMONS_REST_API_HOST environment needs to match the LTI tool # environment (because of shared cache interactions) # ensure person is in course before attempting to remove using API # 1. remove ALL roles/enrollments for the test user in this course # to ensure no incidental data causes conflict when we try to add # 2. add via API the role we want to test removing through the UI self.api.remove_user( self.test_settings['test_course']['cid'], test_univ_id) self.api.add_user( self.test_settings['test_course']['cid'], test_univ_id, role_id) user_list_page = UserListPageObject(self.driver) # note delete_user() requires the Canvas role name, not our display # name (e.g. ObserverEnrollment, not Observer) # Note: the refresh has been added due to issues with remove. If # user is added via the api but the page isn't reload, the tests will # sporadically fail out with NoSuchElementException. self.driver.refresh() self.setUp() user_list_page.delete_user(test_univ_id, canvas_role) # Verify that user is not on the page after getting removed self.assertTrue(user_list_page.is_loaded()) self.assertFalse( user_list_page.user_present_with_role(test_univ_id, role))
def test_remove_users(self, test_case_id, test_user_id, test_univ_id, role, role_id, canvas_role, success_msg_ind, remove_list_ind, error_msg_ind, add_remove_ind): if add_remove_ind != 'remove': return test_univ_id = self.normalize_xlrd_number(test_univ_id, '{0:08d}') role_id = self.normalize_xlrd_number(role_id) self.start_message(test_user_id, test_univ_id, role, role_id) # Note: ICOMMONS_REST_API_HOST environment needs to match the LTI tool # environment (because of shared cache interactions) # ensure person is in course before attempting to remove using API # 1. remove ALL roles/enrollments for the test user in this course # to ensure no incidental data causes conflict when we try to add # 2. add via API the role we want to test removing through the UI self.api.remove_user(self.test_settings['test_course']['cid'], test_univ_id) self.api.add_user(self.test_settings['test_course']['cid'], test_univ_id, role_id) user_list_page = UserListPageObject(self.driver) # Note: the refresh has been added due to issues with remove. If # user is added via the api but the page isn't reload, the tests will # sporadically fail out with NoSuchElementException. self.driver.refresh() self.setUp() # Delete the user in Canvas user_list_page.delete_user(test_univ_id, role_id) self.assertTrue(user_list_page.is_loaded()) # Note: the refresh has been added due to issues with remove. If the # user has been deleted via the UI, but the page isn't reloaded, # it would sporadically fail out with an assertion error. We have # yet to find a more graceful solution. self.driver.refresh() self.setUp() # Assert that the deleted user does not appear in Manage People self.assertFalse( user_list_page.user_present_with_role(test_univ_id, role_id))
class ManagePeopleBaseTestCase(CourseAdminBaseTestCase): def setUp(self): """ Redirects browser to test course URL and login to PIN using specified credentials. """ super(CourseAdminBaseTestCase, self).setUp() # instantiate self.dashboard_page = CourseAdminDashboardPage(self.driver) self.manage_people = UserListPageObject(self.driver) self.test_settings = settings.SELENIUM_CONFIG['manage_people'] # initialize if not self.dashboard_page.is_loaded(): self.dashboard_page.get(self.TOOL_URL) # navigate to cross-list tool self.dashboard_page.select_manage_people_link() # check if page is loaded (which will also set the focus on the tool) self.assertTrue(self.manage_people.is_loaded())
class ManagePeopleBaseTestCase(CourseAdminBaseTestCase): def setUp(self): """ Redirects browser to test course URL and login to PIN using specified credentials. """ super(CourseAdminBaseTestCase, self).setUp() # instantiate self.dashboard_page = CourseAdminDashboardPage(self.driver) self.manage_people = UserListPageObject(self.driver) self.test_settings = settings.SELENIUM_CONFIG['manage_people'] # initialize if not self.dashboard_page.is_loaded(): self.dashboard_page.get(self.TOOL_URL) # navigate to cross-list tool self.dashboard_page.select_manage_people_link() # check if page is loaded (which will also set the focus on the tool) self.assertTrue(self.manage_people.is_loaded())