def create_user_realm_stub(self, protocol, accountType, mexUrl, wstrustUrl, err=None): userRealm = UserRealm(cp['callContext'], '', '') userRealm.discover = mock.MagicMock()#TODO: verify the mock gets called userRealm.federation_protocol = protocol userRealm.account_type = accountType userRealm.federation_metadata_url = mexUrl userRealm.federation_active_auth_url = wstrustUrl return userRealm
def create_user_realm_stub(self, protocol, accountType, mexUrl, wstrustUrl, err=None): userRealm = UserRealm(cp['callContext'], '', '') def side_effect(callback): callback(err) userRealm.discover = mock.MagicMock(side_effect=side_effect) userRealm._federationProtocol = protocol userRealm._accountType = accountType userRealm._federationMetadataUrl = mexUrl userRealm._federationActiveAuthUrl = wstrustUrl return userRealm