Blame SOURCES/validate_idp_list_test.patch

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