spec/mongo/crypt/auto_encrypter_spec.rb in mongo-2.20.1 vs spec/mongo/crypt/auto_encrypter_spec.rb in mongo-2.21.0
- old
+ new
@@ -56,10 +56,12 @@
}
]
)
end
+ let(:operation_context) { Mongo::Operation::Context.new }
+
shared_context 'with jsonSchema validator' do
before do
users_collection = client.use(db_name)[collection_name]
users_collection.drop
client.use(db_name)[collection_name,
@@ -79,18 +81,18 @@
end
shared_examples 'a functioning auto encrypter' do
describe '#encrypt' do
it 'replaces the ssn field with a BSON::Binary' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(encrypted_command)
end
end
describe '#decrypt' do
it 'returns the unencrypted document' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
@@ -327,89 +329,89 @@
context 'with AWS KMS providers' do
include_context 'with AWS kms_providers'
describe '#encrypt' do
it 'does not perform encryption' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(command)
end
end
describe '#decrypt' do
it 'still performs decryption' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
context 'with Azure KMS providers' do
include_context 'with Azure kms_providers'
describe '#encrypt' do
it 'does not perform encryption' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(command)
end
end
describe '#decrypt' do
it 'still performs decryption' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
context 'with GCP KMS providers' do
include_context 'with GCP kms_providers'
describe '#encrypt' do
it 'does not perform encryption' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(command)
end
end
describe '#decrypt' do
it 'still performs decryption' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
context 'with KMIP KMS providers' do
include_context 'with KMIP kms_providers'
describe '#encrypt' do
it 'does not perform encryption' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(command)
end
end
describe '#decrypt' do
it 'still performs decryption' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
context 'with local KMS providers' do
include_context 'with local kms_providers'
describe '#encrypt' do
it 'does not perform encryption' do
- result = auto_encrypter.encrypt(db_name, command)
+ result = auto_encrypter.encrypt(db_name, command, operation_context)
expect(result).to eq(command)
end
end
describe '#decrypt' do
it 'still performs decryption' do
- result = auto_encrypter.decrypt(encrypted_command)
+ result = auto_encrypter.decrypt(encrypted_command, operation_context)
expect(result).to eq(command)
end
end
end
end