Skip to content

Migrate "test/unit/test_providers_raw_master_key_provider.py" from unittest to pytest #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 18, 2018
8 changes: 3 additions & 5 deletions test/unit/test_providers_raw_master_key_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
"""Test suite for aws_encryption_sdk.key_providers.raw.RawMasterKeyProvider"""
import unittest

import attr
import pytest
import six
from mock import MagicMock, patch, sentinel

from aws_encryption_sdk.key_providers.base import MasterKeyProvider, MasterKeyProviderConfig
Expand All @@ -42,16 +39,17 @@ def _get_raw_key(self, key_id):
return self.config.mock_wrapping_key


class TestRawMasterKeyProvider(unittest.TestCase):
class TestRawMasterKeyProvider(object):
def test_parent(self):
assert issubclass(RawMasterKeyProvider, MasterKeyProvider)

def test_get_raw_key_enforcement(self):
class TestProvider(RawMasterKeyProvider):
pass

with six.assertRaisesRegex(self, TypeError, "Can't instantiate abstract class TestProvider *"):
with pytest.raises(TypeError) as excinfo:
TestProvider()
excinfo.match("Can't instantiate abstract class TestProvider *")

@patch(
"aws_encryption_sdk.key_providers.raw.RawMasterKeyConfig", return_value=sentinel.raw_master_key_config_instance
Expand Down