module Voynich::TestSupport::StubKMS

Public Instance Methods

stub_kms_request() click to toggle source
# File lib/voynich/test_support.rb, line 4
def stub_kms_request
  allow(Voynich).to receive(:kms_client) do
    client = Aws::KMS::Client.new(stub_responses: true)
    client.stub_responses(:generate_data_key,
                          plaintext: 'fourty length encoded plaintext data key',
                          ciphertext_blob: 'generated ciphertext blob')
    client.stub_responses(:decrypt, plaintext: 'fourty length encoded plaintext data key')
    client.stub_responses(:re_encrypt, ciphertext_blob: 'reencrypted ciphertext blob')
    client
  end
end