summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/schema/json_schema_parser_test.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2019-04-25 18:38:13 -0400
committerDavid Storch <david.storch@10gen.com>2019-05-15 08:30:10 -0400
commit8dfd014022f0b9cc136e8a22d788089b743422f5 (patch)
treef9e14f4a1886b0eb24b0285edc5655d09b7ac39e /src/mongo/db/matcher/schema/json_schema_parser_test.cpp
parentabbf08f3f4482b1f58f4102cb9178e6ea1039d68 (diff)
downloadmongo-8dfd014022f0b9cc136e8a22d788089b743422f5.tar.gz
SERVER-40477 Make BSON type set available in schema metadata tree.
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.cpp133
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