Skip to content

Commit a755784

Browse files
committed
remove is_jwt_compatible_python_version checks
1 parent eb3ab5d commit a755784

File tree

5 files changed

+1
-36
lines changed

5 files changed

+1
-36
lines changed

rsconnect/json_web_token.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import base64
66
from datetime import datetime, timedelta, timezone
77
import os
8-
import sys
98

109
import binascii
1110
import jwt
@@ -64,14 +63,6 @@ def validate_hs256_secret_key(key: bytes):
6463
raise RSConnectException("Secret key expected to be at least 32 bytes in length")
6564

6665

67-
def is_jwt_compatible_python_version() -> bool:
68-
"""
69-
JWT library is incompatible with Python 3.5
70-
"""
71-
72-
return not sys.version_info < (3, 6)
73-
74-
7566
def parse_client_response(response):
7667
"""
7768
Helper to handle the response type from RSConnectClient, because

rsconnect/main.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
from .json_web_token import (
7272
read_secret_key,
7373
validate_hs256_secret_key,
74-
is_jwt_compatible_python_version,
7574
TokenGenerator,
7675
produce_bootstrap_output,
7776
parse_client_response,
@@ -333,11 +332,6 @@ def bootstrap(
333332
verbose,
334333
):
335334
set_verbosity(verbose)
336-
if not is_jwt_compatible_python_version():
337-
raise RSConnectException(
338-
"Python version > 3.5 required for JWT generation. Please upgrade your Python installation."
339-
)
340-
341335
if not server.startswith("http"):
342336
raise RSConnectException("Server URL expected to begin with transfer protocol (ex. http/https).")
343337

tests/test_json_web_token.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
SECRET_KEY_ENV,
1919
read_secret_key,
2020
produce_bootstrap_output,
21-
is_jwt_compatible_python_version,
2221
parse_client_response,
2322
TokenGenerator,
2423
JWTEncoder,
@@ -43,9 +42,6 @@ def are_unix_timestamps_approx_equal(a, b):
4342

4443
class TestJsonWebToken(TestCase):
4544
def setUp(self):
46-
if not is_jwt_compatible_python_version():
47-
self.skipTest("JWTs not supported in Python < 3.6")
48-
4945
# decoded copy of the base64-encoded key in testdata/jwt/secret.key
5046
self.secret_key = b"12345678901234567890123456789012345"
5147
self.secret_key_b64 = b"MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU="
@@ -186,13 +182,6 @@ def test_parse_client_response(self):
186182
with pytest.raises(RSConnectException):
187183
parse_client_response(None)
188184

189-
def test_is_jwt_compatible_python_version(self):
190-
"""
191-
With setUp() skipping invalid versions, this test should always return True
192-
regardless of the particular python env we're running the tests in
193-
"""
194-
self.assertTrue(is_jwt_compatible_python_version())
195-
196185
def test_jwt_encoder_constructor(self):
197186
encoder = JWTEncoder("issuer", "audience", self.secret_key)
198187

tests/test_main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010
from click.testing import CliRunner
1111

12-
from rsconnect.json_web_token import SECRET_KEY_ENV, is_jwt_compatible_python_version
12+
from rsconnect.json_web_token import SECRET_KEY_ENV
1313

1414
from .utils import (
1515
apply_common_args,
@@ -561,9 +561,6 @@ def test_add_shinyapps_missing_options(self):
561561

562562
class TestBootstrap(TestCase):
563563
def setUp(self):
564-
if not is_jwt_compatible_python_version():
565-
self.skipTest("JWTs not supported in Python < 3.6")
566-
567564
self.mock_server = "http://localhost:8080"
568565
self.mock_uri = "http://localhost:8080/__api__/v1/experimental/bootstrap"
569566
self.jwt_keypath = "tests/testdata/jwt/secret.key"

tests/test_utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from unittest import TestCase
22
from datetime import timedelta
33

4-
from rsconnect.json_web_token import is_jwt_compatible_python_version
5-
64
from rsconnect.json_web_token import JWTEncoder
75

86
from tests.utils import (
@@ -12,10 +10,6 @@
1210

1311

1412
class TestJwtUtils(TestCase):
15-
def setUp(self):
16-
if not is_jwt_compatible_python_version():
17-
self.skipTest("JWTs not supported in Python < 3.6")
18-
1913
def test_jwt_decoder(self):
2014

2115
secret = b"12345678912345678912345678912345"

0 commit comments

Comments
 (0)