예제 #1
0
 def test_encrypt_data_key_unsuccessful_keyerror(self):
     self.mock_client.encrypt.side_effect = KeyError
     test = KMSMasterKey(config=self.mock_kms_mkc_3)
     with six.assertRaisesRegex(self, EncryptKeyError,
                                'Master Key .* unable to encrypt data key'):
         test._encrypt_data_key(self.mock_data_key, self.mock_algorithm)
예제 #2
0
 def test_init(self):
     self.mock_client.meta.config.user_agent_extra = sentinel.user_agent_extra
     test = KMSMasterKey(config=self.mock_kms_mkc_1)
     assert test._key_id == VALUES["arn"].decode("utf-8")
예제 #3
0
 def test_generate_data_key_unsuccessful_keyerror(self):
     self.mock_client.generate_data_key.side_effect = KeyError
     test = KMSMasterKey(config=self.mock_kms_mkc_3)
     with pytest.raises(GenerateKeyError) as excinfo:
         test._generate_data_key(self.mock_algorithm)
     excinfo.match("Master Key .* unable to generate data key")
예제 #4
0
 def test_encrypt_data_key_unsuccessful_keyerror(self):
     self.mock_client.encrypt.side_effect = KeyError
     test = KMSMasterKey(config=self.mock_kms_mkc_3)
     with pytest.raises(EncryptKeyError) as excinfo:
         test._encrypt_data_key(self.mock_data_key, self.mock_algorithm)
     excinfo.match("Master Key .* unable to encrypt data key")
예제 #5
0
 def test_init_kms_master_key(self, key_id):
     self.mock_client.meta.config.user_agent_extra = sentinel.user_agent_extra
     config = KMSMasterKeyConfig(key_id=key_id, client=self.mock_client)
     test = KMSMasterKey(config=config)
     assert test._key_id == key_id