From 09a4d177f5f4e47ec8eb24fc7bef236c6fb4f9c0 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Tue, 14 Mar 2017 23:42:47 -0400 Subject: [PATCH] Add kms boto3 test. --- moto/kms/responses.py | 1 - tests/test_kms/test_kms.py | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/moto/kms/responses.py b/moto/kms/responses.py index 7ed8927a2..0f544e954 100644 --- a/moto/kms/responses.py +++ b/moto/kms/responses.py @@ -231,7 +231,6 @@ class KmsResponse(BaseResponse): def decrypt(self): value = self.parameters.get("CiphertextBlob") - print("value 3", value) return json.dumps({"Plaintext": base64.b64decode(value).decode("utf-8")}) diff --git a/tests/test_kms/test_kms.py b/tests/test_kms/test_kms.py index e1468cce0..8d034c7ff 100644 --- a/tests/test_kms/test_kms.py +++ b/tests/test_kms/test_kms.py @@ -1,11 +1,12 @@ from __future__ import unicode_literals import re +import boto3 import boto.kms from boto.exception import JSONResponseError from boto.kms.exceptions import AlreadyExistsException, NotFoundException import sure # noqa -from moto import mock_kms_deprecated +from moto import mock_kms, mock_kms_deprecated from nose.tools import assert_raises @@ -600,3 +601,12 @@ def test__assert_default_policy(): "not-default").should.throw(JSONResponseError) _assert_default_policy.when.called_with( "default").should_not.throw(JSONResponseError) + + +@mock_kms +def test_kms_encrypt_boto3(): + client = boto3.client('kms', region_name='us-east-1') + response = client.encrypt(KeyId='foo', Plaintext=b'bar') + + response = client.decrypt(CiphertextBlob=response['CiphertextBlob']) + response['Plaintext'].should.equal(b'bar')