diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2016-11-07 08:44:36 +0100 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2016-11-15 12:41:20 +0100 |
commit | c661c44a3689fbc2aa562cc81b9a884f29735694 (patch) | |
tree | 2c9e40b72d72b1e259caf17285d902777dca90b2 /tests | |
parent | bd93c273ea787df4f3fe03c9cf6c8e53d8fc5fc9 (diff) | |
download | libsoup-c661c44a3689fbc2aa562cc81b9a884f29735694.tar.gz |
Add API to clear cached credentials from SoupAuthManager
In WebKit, we need to clear the cached credentials. It's mainly used by
tests to ensure that auth tests are independent to each other.
https://bugzilla.gnome.org/show_bug.cgi?id=774031
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auth-test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auth-test.c b/tests/auth-test.c index 775c7f8d..cf1f246b 100644 --- a/tests/auth-test.c +++ b/tests/auth-test.c @@ -1264,6 +1264,29 @@ do_batch_tests (gconstpointer data) soup_test_session_abort_unref (session); } +static void +do_clear_credentials_test (void) +{ + SoupSession *session; + SoupAuthManager *manager; + char *uri; + + SOUP_TEST_SKIP_IF_NO_APACHE; + + session = soup_test_session_new (SOUP_TYPE_SESSION, NULL); + + uri = g_strconcat (base_uri, "Digest/realm1/", NULL); + do_digest_nonce_test (session, "First", uri, TRUE, TRUE); + + manager = SOUP_AUTH_MANAGER (soup_session_get_feature (session, SOUP_TYPE_AUTH_MANAGER)); + soup_auth_manager_clear_cached_credentials (manager); + + do_digest_nonce_test (session, "Second", uri, TRUE, TRUE); + g_free (uri); + + soup_test_session_abort_unref (session); +} + int main (int argc, char **argv) { @@ -1286,6 +1309,7 @@ main (int argc, char **argv) g_test_add_func ("/auth/auth-close", do_auth_close_test); g_test_add_func ("/auth/infinite-auth", do_infinite_auth_test); g_test_add_func ("/auth/disappearing-auth", do_disappearing_auth_test); + g_test_add_func ("/auth/clear-credentials", do_clear_credentials_test); ret = g_test_run (); |