Skip to content

Commit

Permalink
Add failing test for non-bytes, non-RSAPrivateKey value
Browse files Browse the repository at this point in the history
  • Loading branch information
malthe committed Aug 3, 2023
1 parent f779da2 commit 48e5aca
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/unit/test_auth_keypair.py
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

from pytest import raises
from unittest.mock import MagicMock, Mock, PropertyMock

from cryptography.hazmat.backends import default_backend
Expand Down Expand Up @@ -94,6 +95,24 @@ def test_auth_keypair_abc():
assert rest.master_token == "MASTER_TOKEN"


def test_auth_keypair_bad_type():
"""Simple Key Pair test using abstraction layer."""
account = "testaccount"
user = "testuser"
class Bad:
pass
auth_instance = AuthByKeyPair(private_key=Bad())
with raises(TypeError) as ex:
auth_instance.handle_timeout(
authenticator="SNOWFLAKE_JWT",
service_name=None,
account=account,
user=user,
password=None,
)
assert 'Bad' in str(ex)


def _init_rest(application, post_requset):
connection = MagicMock()
connection._login_timeout = 120
Expand Down

0 comments on commit 48e5aca

Please sign in to comment.