[tests] protect the ID-FF 1.2 test cases from effect of the thin-sessions flag until it is migrated to work also with thin sessions

This commit is contained in:
Benjamin Dauvergne 2011-12-22 18:22:12 +01:00
parent 3dca5c2afa
commit 56d584ca69
1 changed files with 19 additions and 2 deletions

View File

@ -33,6 +33,15 @@
#include "tests.h" #include "tests.h"
#include "../bindings/ghashtable.h" #include "../bindings/ghashtable.h"
#define save_thin_session \
gboolean old_thin_sessions = lasso_flag_thin_sessions;
#define push_thin_sessions \
lasso_flag_thin_sessions = FALSE;
#define pop_thin_sessions \
lasso_flag_thin_sessions = old_thin_sessions;
static char* static char*
generateIdentityProviderContextDump() generateIdentityProviderContextDump()
@ -151,6 +160,7 @@ START_TEST(test02_serviceProviderLogin)
char *spLoginDump; char *spLoginDump;
int requestType; int requestType;
char *found; char *found;
save_thin_session;
serviceProviderContextDump = generateServiceProviderContextDump(); serviceProviderContextDump = generateServiceProviderContextDump();
spContext = lasso_server_new_from_dump(serviceProviderContextDump); spContext = lasso_server_new_from_dump(serviceProviderContextDump);
@ -180,6 +190,7 @@ START_TEST(test02_serviceProviderLogin)
"authnRequestQuery RelayState parameter should be encoded"); "authnRequestQuery RelayState parameter should be encoded");
/* Identity provider singleSignOn, for a user having no federation. */ /* Identity provider singleSignOn, for a user having no federation. */
push_thin_sessions;
identityProviderContextDump = generateIdentityProviderContextDump(); identityProviderContextDump = generateIdentityProviderContextDump();
idpContext = lasso_server_new_from_dump(identityProviderContextDump); idpContext = lasso_server_new_from_dump(identityProviderContextDump);
idpLoginContext = lasso_login_new(idpContext); idpLoginContext = lasso_login_new(idpContext);
@ -228,6 +239,7 @@ START_TEST(test02_serviceProviderLogin)
serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID); serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID);
fail_unless(serviceProviderId != NULL, fail_unless(serviceProviderId != NULL,
"lasso_profile_get_remote_providerID shouldn't return NULL"); "lasso_profile_get_remote_providerID shouldn't return NULL");
pop_thin_sessions;
/* Service provider assertion consumer */ /* Service provider assertion consumer */
lasso_server_destroy(spContext); lasso_server_destroy(spContext);
@ -250,6 +262,7 @@ START_TEST(test02_serviceProviderLogin)
soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body; soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body;
fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL"); fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL");
push_thin_sessions;
/* Identity provider SOAP endpoint */ /* Identity provider SOAP endpoint */
lasso_server_destroy(idpContext); lasso_server_destroy(idpContext);
lasso_login_destroy(idpLoginContext); lasso_login_destroy(idpLoginContext);
@ -267,6 +280,7 @@ START_TEST(test02_serviceProviderLogin)
check_good_rc(lasso_login_build_response_msg(idpLoginContext, serviceProviderId)); check_good_rc(lasso_login_build_response_msg(idpLoginContext, serviceProviderId));
soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body; soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body;
fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL"); fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL");
pop_thin_sessions;
/* Service provider assertion consumer (step 2: process SOAP response) */ /* Service provider assertion consumer (step 2: process SOAP response) */
check_good_rc(lasso_login_process_response_msg(spLoginContext, soapResponseMsg)); check_good_rc(lasso_login_process_response_msg(spLoginContext, soapResponseMsg));
@ -323,6 +337,7 @@ START_TEST(test03_serviceProviderLogin)
char *spIdentityContextDump; char *spIdentityContextDump;
char *spSessionDump; char *spSessionDump;
int requestType; int requestType;
save_thin_session;
serviceProviderContextDump = generateServiceProviderContextDump(); serviceProviderContextDump = generateServiceProviderContextDump();
spContext = lasso_server_new_from_dump(serviceProviderContextDump); spContext = lasso_server_new_from_dump(serviceProviderContextDump);
@ -348,6 +363,7 @@ START_TEST(test03_serviceProviderLogin)
fail_unless(strlen(authnRequestQuery) > 0, fail_unless(strlen(authnRequestQuery) > 0,
"authnRequestRequest shouldn't be an empty string"); "authnRequestRequest shouldn't be an empty string");
push_thin_sessions;
/* Identity provider singleSignOn, for a user having no federation. */ /* Identity provider singleSignOn, for a user having no federation. */
identityProviderContextDump = generateIdentityProviderContextDumpMemory(); identityProviderContextDump = generateIdentityProviderContextDumpMemory();
idpContext = lasso_server_new_from_dump(identityProviderContextDump); idpContext = lasso_server_new_from_dump(identityProviderContextDump);
@ -366,7 +382,6 @@ START_TEST(test03_serviceProviderLogin)
1, /* authentication_result */ 1, /* authentication_result */
0 /* is_consent_obtained */ 0 /* is_consent_obtained */
); );
rc = lasso_login_build_assertion(idpLoginContext, rc = lasso_login_build_assertion(idpLoginContext,
LASSO_SAML_AUTHENTICATION_METHOD_PASSWORD, LASSO_SAML_AUTHENTICATION_METHOD_PASSWORD,
"FIXME: authenticationInstant", "FIXME: authenticationInstant",
@ -375,7 +390,6 @@ START_TEST(test03_serviceProviderLogin)
"FIXME: notOnOrAfter"); "FIXME: notOnOrAfter");
rc = lasso_login_build_artifact_msg(idpLoginContext, LASSO_HTTP_METHOD_REDIRECT); rc = lasso_login_build_artifact_msg(idpLoginContext, LASSO_HTTP_METHOD_REDIRECT);
fail_unless(rc == 0, "lasso_login_build_artifact_msg failed"); fail_unless(rc == 0, "lasso_login_build_artifact_msg failed");
idpIdentityContextDump = lasso_identity_dump(LASSO_PROFILE(idpLoginContext)->identity); idpIdentityContextDump = lasso_identity_dump(LASSO_PROFILE(idpLoginContext)->identity);
fail_unless(idpIdentityContextDump != NULL, fail_unless(idpIdentityContextDump != NULL,
"lasso_identity_dump shouldn't return NULL"); "lasso_identity_dump shouldn't return NULL");
@ -390,6 +404,7 @@ START_TEST(test03_serviceProviderLogin)
serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID); serviceProviderId = g_strdup(LASSO_PROFILE(idpLoginContext)->remote_providerID);
fail_unless(serviceProviderId != NULL, fail_unless(serviceProviderId != NULL,
"lasso_profile_get_remote_providerID shouldn't return NULL"); "lasso_profile_get_remote_providerID shouldn't return NULL");
pop_thin_sessions;
/* Service provider assertion consumer */ /* Service provider assertion consumer */
lasso_server_destroy(spContext); lasso_server_destroy(spContext);
@ -406,6 +421,7 @@ START_TEST(test03_serviceProviderLogin)
soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body; soapRequestMsg = LASSO_PROFILE(spLoginContext)->msg_body;
fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL"); fail_unless(soapRequestMsg != NULL, "soapRequestMsg must not be NULL");
push_thin_sessions;
/* Identity provider SOAP endpoint */ /* Identity provider SOAP endpoint */
lasso_server_destroy(idpContext); lasso_server_destroy(idpContext);
lasso_login_destroy(idpLoginContext); lasso_login_destroy(idpLoginContext);
@ -425,6 +441,7 @@ START_TEST(test03_serviceProviderLogin)
fail_unless(rc == 0, "lasso_login_build_response_msg failed"); fail_unless(rc == 0, "lasso_login_build_response_msg failed");
soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body; soapResponseMsg = LASSO_PROFILE(idpLoginContext)->msg_body;
fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL"); fail_unless(soapResponseMsg != NULL, "soapResponseMsg must not be NULL");
pop_thin_sessions;
/* Service provider assertion consumer (step 2: process SOAP response) */ /* Service provider assertion consumer (step 2: process SOAP response) */
rc = lasso_login_process_response_msg(spLoginContext, soapResponseMsg); rc = lasso_login_process_response_msg(spLoginContext, soapResponseMsg);