You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/07 16:37:54 UTC

svn commit: r1443562 - /subversion/trunk/subversion/tests/libsvn_subr/auth-test.c

Author: rhuijben
Date: Thu Feb  7 15:37:53 2013
New Revision: 1443562

URL: http://svn.apache.org/viewvc?rev=1443562&view=rev
Log:
* subversion/tests/libsvn_subr/auth-test.c
  (test_auth_clear): New function. This triggers the issue fixed in r1443556.
  (test_funcs): Add test_auth_clear.

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/auth-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/auth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/auth-test.c?rev=1443562&r1=1443561&r2=1443562&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/auth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/auth-test.c Thu Feb  7 15:37:53 2013
@@ -22,6 +22,7 @@
  */
 
 #include "svn_auth.h"
+#include "svn_dirent_uri.h"
 #include "svn_private_config.h"
 
 #include "../svn_test.h"
@@ -206,6 +207,61 @@ test_platform_specific_auth_providers(ap
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_auth_clear(apr_pool_t *pool)
+{
+  const char *auth_dir;
+  svn_auth_provider_object_t *provider;
+  svn_auth_baton_t *baton;
+  apr_array_header_t *providers;
+  void *credentials;
+  svn_auth_cred_simple_t *creds;
+  svn_auth_iterstate_t *state;
+
+  SVN_ERR(svn_dirent_get_absolute(&auth_dir, "", pool));
+  auth_dir = svn_dirent_join(auth_dir, "auth-clear", pool);
+
+  svn_test_add_dir_cleanup(auth_dir);
+
+  SVN_ERR(svn_io_remove_dir2(auth_dir, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_dir_make(auth_dir, APR_OS_DEFAULT, pool));
+
+  svn_auth_get_simple_provider2(&provider, NULL, NULL, pool);
+
+  providers = apr_array_make(pool, 1, sizeof(svn_auth_provider_object_t *));
+  APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+  svn_auth_open(&baton, providers, pool);
+
+  svn_auth_set_parameter(baton, SVN_AUTH_PARAM_DEFAULT_USERNAME, "jrandom");
+  svn_auth_set_parameter(baton, SVN_AUTH_PARAM_DEFAULT_PASSWORD, "rayjandom");
+  svn_auth_set_parameter(baton, SVN_AUTH_PARAM_CONFIG_DIR, auth_dir);
+
+  SVN_ERR(svn_config_ensure(auth_dir, pool));
+
+  /* Obtain the default credentials just passed */
+  SVN_ERR(svn_auth_first_credentials(&credentials,
+                                     &state,
+                                     SVN_AUTH_CRED_SIMPLE,
+                                     "<http://my.host> My realm",
+                                     baton,
+                                     pool));
+
+  creds = credentials;
+  SVN_TEST_ASSERT(! strcmp(creds->username, "jrandom"));
+  SVN_TEST_ASSERT(creds->may_save);
+
+  /* And tell that they are ok and can be saved */
+  SVN_ERR(svn_auth_save_credentials(state, pool));
+
+  /* Ok, and now we try to remove the credentials */
+
+  /* ### TODO: Implement to resolve issue #2775 */
+
+
+  return SVN_NO_ERROR;
+}
+
 
 /* The test table.  */
 
@@ -214,5 +270,7 @@ struct svn_test_descriptor_t test_funcs[
     SVN_TEST_NULL,
     SVN_TEST_PASS2(test_platform_specific_auth_providers,
                    "test retrieving platform-specific auth providers"),
+    SVN_TEST_PASS2(test_auth_clear,
+                   "test svn_auth_clear()"),
     SVN_TEST_NULL
   };