Blame SOURCES/validate_idp_list_test.patch

38f12d
commit 11ebfeb62148a89e2ebae90d7c70be918cfdc244
38f12d
Author: John Dennis <jdennis@redhat.com>
38f12d
Date:   Fri Jun 17 11:58:24 2016 -0400
38f12d
38f12d
    Fix ecp test validate_idp_list()
38f12d
    
38f12d
    validate_idp_list was not using the correct list elements when it
38f12d
    iterated over the known_sp_provided_idp_entries_supporting_ecp list.
38f12d
    It treated them as lists of strings instead of lists of
38f12d
    LassoSamlp2IDPEntry.
38f12d
    
38f12d
    Signed-off-by: John Dennis <jdennis@redhat.com>
38f12d
    License: MIT
38f12d
38f12d
diff --git a/tests/login_tests_saml2.c b/tests/login_tests_saml2.c
38f12d
index 84011ec..54c7fb6 100644
38f12d
--- a/tests/login_tests_saml2.c
38f12d
+++ b/tests/login_tests_saml2.c
38f12d
@@ -1245,18 +1245,29 @@ static void validate_idp_list(LassoEcp *ecp, EcpIdpListVariant ecpIDPListVariant
38f12d
 
38f12d
 		if (ecpIDPListVariant == ECP_IDP_LIST_ECP) {
38f12d
 			check_not_null(ecp->known_sp_provided_idp_entries_supporting_ecp);
38f12d
+			check_equals(g_list_length(ecp->known_sp_provided_idp_entries_supporting_ecp),
38f12d
+						 g_list_length(idp_list->IDPEntry));
38f12d
+
38f12d
 			for (ecp_iter = g_list_first(ecp->known_sp_provided_idp_entries_supporting_ecp),
38f12d
 				 src_iter = g_list_first(idp_list->IDPEntry);
38f12d
 				 ecp_iter && src_iter;
38f12d
 				 ecp_iter = g_list_next(ecp_iter), src_iter = g_list_next(src_iter)) {
38f12d
-				gchar *ecp_item, *src_item;
38f12d
+				LassoSamlp2IDPEntry *ecp_item, *src_item;
38f12d
+
38f12d
+				ecp_item = LASSO_SAMLP2_IDP_ENTRY(ecp_iter->data);
38f12d
+				src_item = LASSO_SAMLP2_IDP_ENTRY(src_iter->data);
38f12d
+
38f12d
+				check_not_null(ecp_item->ProviderID);
38f12d
+				check_not_null(src_item->ProviderID);
38f12d
+				check_str_equals(ecp_item->ProviderID, src_item->ProviderID);
38f12d
 
38f12d
-				ecp_item = ecp_iter->data;
38f12d
-				src_item = src_iter->data;
38f12d
+				check_not_null(ecp_item->Name);
38f12d
+				check_not_null(src_item->Name);
38f12d
+				check_str_equals(ecp_item->Name, src_item->Name);
38f12d
 
38f12d
-				check_not_null(ecp_item);
38f12d
-				check_not_null(src_item);
38f12d
-				check_str_equals(ecp_item, src_item);
38f12d
+				check_not_null(ecp_item->Loc);
38f12d
+				check_not_null(src_item->Loc);
38f12d
+				check_str_equals(ecp_item->Loc, src_item->Loc);
38f12d
 			}
38f12d
 		} else {
38f12d
 			check_null(ecp->known_sp_provided_idp_entries_supporting_ecp);
38f12d
@@ -1356,7 +1367,6 @@ void test_ecp(EcpIdpListVariant ecpIDPListVariant)
38f12d
 	check_null(LASSO_PROFILE(spLoginContext)->msg_url);
38f12d
 	check_not_null(strstr(spPaosRequestMsg, "RelayState"));
38f12d
 
38f12d
-
38f12d
 	/* Finished with SP Login Context, will create new one later */
38f12d
 	lasso_server_destroy(spContext);
38f12d
 	spContext = NULL;
38f12d
@@ -1388,7 +1398,7 @@ void test_ecp(EcpIdpListVariant ecpIDPListVariant)
38f12d
 	check_str_equals(ecp->relaystate, relayState);
38f12d
 	check_str_equals(ecp->issuer->content, "http://sp5/metadata");
38f12d
 	check_str_equals(ecp->provider_name, provider_name);
38f12d
-    check_equals(ecp->is_passive, is_passive);
38f12d
+	check_equals(ecp->is_passive, is_passive);
38f12d
 
38f12d
 	/* Validate ECP IdP list info & default IdP URL */
38f12d
 	validate_idp_list(ecp, ecpIDPListVariant, idp_list);