diff options
Diffstat (limited to 'src/mongo/db/matcher/schema/json_schema_parser_test.cpp')
-rw-r--r-- | src/mongo/db/matcher/schema/json_schema_parser_test.cpp | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/src/mongo/db/matcher/schema/json_schema_parser_test.cpp b/src/mongo/db/matcher/schema/json_schema_parser_test.cpp index b6b5c2c3ce9..63362d54387 100644 --- a/src/mongo/db/matcher/schema/json_schema_parser_test.cpp +++ b/src/mongo/db/matcher/schema/json_schema_parser_test.cpp @@ -2166,138 +2166,5 @@ TEST(JSONSchemaParserTest, FailsToParseWithNonUUIDArrayElement) { ASSERT_EQ(result.getStatus().code(), 51084); } -TEST(JSONSchemaParserTest, FailsToParseWithNoBSONTypeInDeterministicEncrypt) { - auto uuid = UUID::gen(); - BSONObj schema = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "keyId" - << BSON_ARRAY(uuid))); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31051); -} - -TEST(JSONSchemaParserTest, FailsToParseWithBSONTypeObjectInDeterministicEncrypt) { - auto uuid = UUID::gen(); - BSONObj schema = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "keyId" - << BSON_ARRAY(uuid) - << "bsonType" - << "object")); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31051); -} - -TEST(JSONSchemaParserTest, FailsToParseWithEmptyArrayBSONTypeInDeterministicEncrypt) { - auto uuid = UUID::gen(); - BSONObj schema = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "keyId" - << BSON_ARRAY(uuid) - << "bsonType" - << BSONArray())); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31051); -} - -TEST(JSONSchemaParserTest, FailsToParseWithMultipleElementArrayBSONTypeInDeterministicEncrypt) { - auto uuid = UUID::gen(); - BSONObj schema = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "keyId" - << BSON_ARRAY(uuid) - << "bsonType" - << BSON_ARRAY("int" - << "string"))); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31051); -} - -TEST(JSONSchemaParserTest, FailsToParseWithObjectInArrayBSONTypeInDeterministicEncrypt) { - auto uuid = UUID::gen(); - BSONObj schema = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "keyId" - << BSON_ARRAY(uuid) - << "bsonType" - << BSON_ARRAY("object"))); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31051); -} - -TEST(JSONSchemaParserTest, FailsToParseWithSingleValueBSONTypeInEncryptObject) { - auto uuid = UUID::gen(); - // Test MinKey - BSONObj encrypt = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "bsonType" - << "minKey" - << "keyId" - << BSON_ARRAY(uuid))); - BSONObj schema = BSON("type" - << "object" - << "properties" - << BSON("foo" << encrypt)); - auto result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31041); - // Test MaxKey - encrypt = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "bsonType" - << "maxKey" - << "keyId" - << BSON_ARRAY(uuid))); - schema = BSON("type" - << "object" - << "properties" - << BSON("foo" << encrypt)); - result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31041); - // Test Undefined - encrypt = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "bsonType" - << "undefined" - << "keyId" - << BSON_ARRAY(uuid))); - schema = BSON("type" - << "object" - << "properties" - << BSON("foo" << encrypt)); - result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31041); - // Test Null - encrypt = BSON("encrypt" << BSON("algorithm" - << "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - << "initializationVector" - << BSONBinData(NULL, 0, BinDataType::BinDataGeneral) - << "bsonType" - << "null" - << "keyId" - << BSON_ARRAY(uuid))); - schema = BSON("type" - << "object" - << "properties" - << BSON("foo" << encrypt)); - result = JSONSchemaParser::parse(new ExpressionContextForTest(), schema); - ASSERT_EQ(result.getStatus().code(), 31041); -} - } // namespace } // namespace mongo |