def test_decrypt(self):
        provider = StubProvider()
        kf = KeyFile('asdf.txt')
        kf._KeyFile__key = b'x' * 32
        kf._get_provider = MagicMock(return_value=provider)

        text = kf.decrypt(SecureValue('test', b'hello'))
        provider.decrypt.assert_called_once_with(b'hello')
        kf._get_provider.assert_called_once_with('test')
        assert text == b'plaintext'
 def test_decrypt_nokey(self):
     kf = KeyFile('asdf.txt')
     with pytest.raises(TypeError):
         kf.decrypt(b'asdf')