diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2005-03-15 17:27:57 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2005-03-15 17:27:57 +0000 |
commit | 98b4703cef601165b9642bf40644ddf7d46946a5 (patch) | |
tree | 20b802b95409fdbb9e6f5af8ea15de962761be33 /tests/random_tests.c | |
parent | 170f3f25d29300cd544f36b4dab277955db68668 (diff) | |
download | lasso-98b4703cef601165b9642bf40644ddf7d46946a5.tar.gz lasso-98b4703cef601165b9642bf40644ddf7d46946a5.tar.xz lasso-98b4703cef601165b9642bf40644ddf7d46946a5.zip |
added non-regression test for bug #416 (missing namespace in some
samlp:Response)
Diffstat (limited to 'tests/random_tests.c')
-rw-r--r-- | tests/random_tests.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/random_tests.c b/tests/random_tests.c index d632bac1..e2c76232 100644 --- a/tests/random_tests.c +++ b/tests/random_tests.c @@ -31,6 +31,7 @@ #include <lasso/xml/lib_assertion.h> #include <lasso/xml/lib_authentication_statement.h> #include <lasso/xml/saml_name_identifier.h> +#include <lasso/xml/samlp_response.h> Suite* random_suite(); @@ -80,7 +81,6 @@ START_TEST(test01_server_new) TESTSDATADIR "/idp1-la/certificate.pem"); dump = lasso_node_dump(LASSO_NODE(server)); - printf("dump:\n%s\n", dump); } END_TEST @@ -102,7 +102,6 @@ START_TEST(test02_server_add_provider) TESTSDATADIR "/ca1-la/certificate.pem"); dump = lasso_node_dump(LASSO_NODE(server)); - printf("dump:\n%s\n", dump); } END_TEST @@ -127,7 +126,6 @@ START_TEST(test03_server_new_from_dump) server2 = lasso_server_new_from_dump(dump); dump = lasso_node_dump(LASSO_NODE(server2)); - printf("dump:\n%s\n", dump); } END_TEST @@ -157,7 +155,8 @@ START_TEST(test05_xsi_type) /* check lib:AuthnContext element is not converted to * saml:AuthnContext xsi:type="lib:AuthnContextType" and * lib:AuthenticationStatement is converted to - * saml:AuthenticationStatement * xsi:type="lib:AuthenticationStatementType"*/ + * saml:AuthenticationStatement * xsi:type="lib:AuthenticationStatementType" + */ LassoSamlAssertion *assertion; LassoLibAuthenticationStatement *stmt; @@ -182,6 +181,26 @@ START_TEST(test05_xsi_type) } END_TEST +START_TEST(test06_lib_statuscode) +{ + /* check status code value in samlp:Response; it is a QName, if it + * starts with lib:, that namespace must be defined. (was bug#416) + */ + LassoSamlpResponse *response = LASSO_SAMLP_RESPONSE(lasso_samlp_response_new()); + + response->Status->StatusCode->Value = g_strdup(LASSO_SAML_STATUS_CODE_SUCCESS); + fail_unless(strstr(lasso_node_dump(LASSO_NODE(response)), "xmlns:lib=") == NULL, + "liberty namespace should not be defined"); + + response->Status->StatusCode->Value = g_strdup(LASSO_SAML_STATUS_CODE_RESPONDER); + response->Status->StatusCode->StatusCode = lasso_samlp_status_code_new(); + response->Status->StatusCode->StatusCode->Value = g_strdup( + LASSO_LIB_STATUS_CODE_UNKNOWN_PRINCIPAL); + fail_unless(strstr(lasso_node_dump(LASSO_NODE(response)), "xmlns:lib=") != NULL, + "liberty namespace should be defined"); +} +END_TEST + Suite* random_suite() { @@ -202,6 +221,7 @@ random_suite() suite_add_tcase(s, tc_node); tcase_add_test(tc_node, test04_node_new_from_dump); tcase_add_test(tc_node, test05_xsi_type); + tcase_add_test(tc_node, test06_lib_statuscode); return s; } |