<s> from nose . tools import * <EOL> from tests . base import ApiTestCase <EOL> from tests . factories import InstitutionFactory , UserFactory <EOL> from api . base . settings . defaults import API_BASE <EOL> class TestInstitutionUsersList ( ApiTestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestInstitutionUsersList , self ) . setUp ( ) <EOL> self . institution = InstitutionFactory ( ) <EOL> self . user1 = UserFactory ( ) <EOL> self . user1 . affiliated_institutions . append ( self . institution ) <EOL> self . user1 . save ( ) <EOL> self . user2 = UserFactory ( ) <EOL> self . user2 . affiliated_institutions . append ( self . institution ) <EOL> self . user2 . save ( ) <EOL> self . institution_user_url = '<STR_LIT>' . format ( API_BASE , self . institution . _id ) <EOL> def test_return_all_users ( self ) : <EOL> res = self . app . get ( self . institution_user_url ) <EOL> assert_equal ( res . status_code , <NUM_LIT:200> ) <EOL> ids = [ each [ '<STR_LIT:id>' ] for each in res . json [ '<STR_LIT:data>' ] ] <EOL> assert_equal ( len ( res . json [ '<STR_LIT:data>' ] ) , <NUM_LIT:2> ) <EOL> assert_in ( self . user1 . _id , ids ) <EOL> assert_in ( self . user2 . _id , ids ) </s>
