Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
malthe committed Aug 3, 2023
1 parent 48e5aca commit 028ef0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/snowflake/connector/auth/keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def prepare(
elif isinstance(self._private_key, RSAPrivateKey):
private_key = self._private_key
else:
raise TypeError(f"Expected bytes or RSAPrivateKey, got {type(self._private_key)}")
raise TypeError(
f"Expected bytes or RSAPrivateKey, got {type(self._private_key)}"
)

public_key_fp = self.calculate_public_key_fingerprint(private_key)

Expand Down
6 changes: 4 additions & 2 deletions test/unit/test_auth_keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

from __future__ import annotations

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

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
from cryptography.hazmat.primitives.serialization import load_der_private_key
from pytest import raises

from snowflake.connector.auth import Auth
from snowflake.connector.constants import OCSPMode
Expand Down Expand Up @@ -99,8 +99,10 @@ 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(
Expand All @@ -110,7 +112,7 @@ class Bad:
user=user,
password=None,
)
assert 'Bad' in str(ex)
assert "Bad" in str(ex)


def _init_rest(application, post_requset):
Expand Down

0 comments on commit 028ef0a

Please sign in to comment.