diff options
author | Julien Boeuf <jboeuf@google.com> | 2015-08-10 12:45:17 -0700 |
---|---|---|
committer | Julien Boeuf <jboeuf@google.com> | 2015-08-13 17:25:52 -0700 |
commit | c2274e706937c1742e72a20a889ce1283d12af52 (patch) | |
tree | e33b3eb2b86119ed634c587e8bfb62ad1e7e1bfe /test | |
parent | 8d428f1e6d0f7b76f8b737ae63f7a74b97279a1d (diff) |
Adding C++ auth metadata processor.
- We always do the processing asynchronously but maintain a synchronous
API for the implementor of the processor.
- there are a lot of string copies right now. Having a StringPiece
object in grpc++ would really help with that (as we would use it for
C++ metadata).
- Please review the API carefully and if you're happy with it, I'll
proceed with tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/common/secure_auth_context_test.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 075d4ce8c9..e208189720 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -57,12 +57,12 @@ TEST_F(SecureAuthContextTest, EmptyContext) { TEST_F(SecureAuthContextTest, Properties) { grpc_auth_context* ctx = grpc_auth_context_create(NULL); - grpc_auth_context_add_cstring_property(ctx, "name", "chapi"); - grpc_auth_context_add_cstring_property(ctx, "name", "chapo"); - grpc_auth_context_add_cstring_property(ctx, "foo", "bar"); - EXPECT_EQ(1, grpc_auth_context_set_peer_identity_property_name(ctx, "name")); - SecureAuthContext context(ctx); + context.AddProperty("name", "chapi"); + context.AddProperty("name", "chapo"); + context.AddProperty("foo", "bar"); + EXPECT_TRUE(context.SetPeerIdentityPropertyName("name")); + std::vector<grpc::string> peer_identity = context.GetPeerIdentity(); EXPECT_EQ(2u, peer_identity.size()); EXPECT_EQ("chapi", peer_identity[0]); @@ -75,12 +75,12 @@ TEST_F(SecureAuthContextTest, Properties) { TEST_F(SecureAuthContextTest, Iterators) { grpc_auth_context* ctx = grpc_auth_context_create(NULL); - grpc_auth_context_add_cstring_property(ctx, "name", "chapi"); - grpc_auth_context_add_cstring_property(ctx, "name", "chapo"); - grpc_auth_context_add_cstring_property(ctx, "foo", "bar"); - EXPECT_EQ(1, grpc_auth_context_set_peer_identity_property_name(ctx, "name")); - SecureAuthContext context(ctx); + context.AddProperty("name", "chapi"); + context.AddProperty("name", "chapo"); + context.AddProperty("foo", "bar"); + EXPECT_TRUE(context.SetPeerIdentityPropertyName("name")); + AuthPropertyIterator iter = context.begin(); EXPECT_TRUE(context.end() != iter); AuthProperty p0 = *iter; |