ext/libcouchbase/tests/iotests/t_misc.cc in libcouchbase-0.0.4 vs ext/libcouchbase/tests/iotests/t_misc.cc in libcouchbase-0.0.5
- old
+ new
@@ -18,10 +18,11 @@
#include "iotests.h"
#include <map>
#include <climits>
#include <algorithm>
#include "internal.h" /* vbucket_* things from lcb_t */
+#include "auth-priv.h"
#include <lcbio/iotable.h>
#include "bucketconfig/bc_http.h"
#define LOGARGS(instance, lvl) \
instance->settings, "tests-MUT", LCB_LOG_##lvl, __FILE__, __LINE__
@@ -708,6 +709,25 @@
mctx = lcb_observe3_ctxnew(instance);
ASSERT_FALSE(mctx == NULL);
err = mctx->done(mctx, NULL);
ASSERT_NE(LCB_SUCCESS, err);
+}
+
+TEST_F(MockUnitTest, testMultiCreds)
+{
+ using lcb::Authenticator;
+
+ HandleWrap hw;
+ lcb_t instance;
+ createConnection(hw, instance);
+
+ lcb_BUCKETCRED cred;
+ cred[0] = "protected";
+ cred[1] = "secret";
+ lcb_error_t rc = lcb_cntl(instance, LCB_CNTL_SET, LCB_CNTL_BUCKET_CRED, cred);
+ ASSERT_EQ(LCB_SUCCESS, rc);
+ Authenticator& auth = *instance->settings->auth;
+ lcb::Authenticator::Map::const_iterator res = auth.buckets().find("protected");
+ ASSERT_NE(auth.buckets().end(), res);
+ ASSERT_EQ("secret", res->second);
}