insecure_security_connector_test.cc
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2020 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 //
18 
20 
21 #include <gmock/gmock.h>
22 #include <gtest/gtest.h>
23 
24 #include <grpc/grpc_security.h>
25 
30 
31 namespace grpc_core {
32 namespace testing {
33 namespace {
34 
35 TEST(InsecureSecurityConnector, MakeAuthContextTest) {
36  auto auth_context = TestOnlyMakeInsecureAuthContext();
37  // Verify that peer is not authenticated
38  EXPECT_EQ(auth_context->is_authenticated(), false);
39  // Verify that GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME is set
41  auth_context.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME);
43  ASSERT_NE(prop, nullptr);
46  // Verify that security level is set to none
50  ASSERT_NE(prop, nullptr);
52 }
53 
54 } // namespace
55 } // namespace testing
56 } // namespace grpc_core
57 
58 int main(int argc, char** argv) {
59  ::testing::InitGoogleTest(&argc, argv);
61  const auto result = RUN_ALL_TESTS();
62  return result;
63 }
tsi_security_level_to_string
const char * tsi_security_level_to_string(tsi_security_level security_level)
Definition: transport_security.cc:70
GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME
#define GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME
Definition: grpc_security_constants.h:47
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
testing
Definition: aws_request_signer_test.cc:25
ASSERT_NE
#define ASSERT_NE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2060
regen-readme.it
it
Definition: regen-readme.py:15
generate.env
env
Definition: generate.py:37
grpc_core
Definition: call_metric_recorder.h:31
grpc_security.h
grpc_auth_property_iterator_next
const GRPCAPI grpc_auth_property * grpc_auth_property_iterator_next(grpc_auth_property_iterator *it)
Definition: security_context.cc:182
grpc_core::kInsecureTransportSecurityType
const char kInsecureTransportSecurityType[]
Definition: insecure_security_connector.cc:39
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
main
int main(int argc, char **argv)
Definition: insecure_security_connector_test.cc:58
GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME
#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME
Definition: grpc_security_constants.h:26
grpc_auth_property::name
char * name
Definition: grpc_security.h:44
grpc_auth_property::value
char * value
Definition: grpc_security.h:45
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
TSI_SECURITY_NONE
@ TSI_SECURITY_NONE
Definition: transport_security_interface.h:54
grpc_auth_property
Definition: grpc_security.h:43
test_config.h
EXPECT_STREQ
#define EXPECT_STREQ(s1, s2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2095
security_context.h
transport_security.h
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
grpc_core::TestOnlyMakeInsecureAuthContext
RefCountedPtr< grpc_auth_context > TestOnlyMakeInsecureAuthContext()
Definition: insecure_security_connector.cc:57
insecure_security_connector.h
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
grpc_core::testing::TEST
TEST(ServiceConfigParserTest, DoubleRegistration)
Definition: service_config_test.cc:448
grpc_auth_context_find_properties_by_name
GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(const grpc_auth_context *ctx, const char *name)
Definition: security_context.cc:207
ssl_utils.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:06