'Test the various roles that allow viewing all of an organization\'s
libraries are working correctly.'

@ddt.data(OrgStaffRole, OrgInstructorRole, OrgLibraryUserRole)
def test_org_based_access(self, org_access_role):

    lib_key_pacific = self._create_library(org='PacificX', library='libP')
    lib_key_atlantic = self._create_library(org='AtlanticX', library='libA')
    self._login_as_non_staff_user()
    org_access_role(lib_key_pacific.org).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(lib_key_pacific))
    self.assertTrue(self._can_access_library(lib_key_pacific))
    self.assertFalse(self._can_access_library(lib_key_atlantic))
    self.assertFalse(self._can_access_library(self.lib_key))
