'Test the various roles that allow viewing libraries are working correctly.'

@ddt.data(CourseInstructorRole, CourseStaffRole, LibraryUserRole)
def test_acccess(self, access_role):

    library2_key = self._create_library(library='lib2')
    self._login_as_non_staff_user()
    lib_list = self._list_libraries()
    self.assertEqual(len(lib_list), 0)
    self.assertFalse(self._can_access_library(self.library))
    self.assertFalse(self._can_access_library(library2_key))
    access_role(library2_key).add_users(self.non_staff_user)
    lib_list = self._list_libraries()
    self.assertEqual(len(lib_list), 1)
    self.assertEqual(lib_list[0]['library_key'], unicode(library2_key))
    self.assertTrue(self._can_access_library(library2_key))
    self.assertFalse(self._can_access_library(self.library))
