File tree Expand file tree Collapse file tree 5 files changed +1
-36
lines changed Expand file tree Collapse file tree 5 files changed +1
-36
lines changed Original file line number Diff line number Diff line change 55import base64
66from datetime import datetime , timedelta , timezone
77import os
8- import sys
98
109import binascii
1110import 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-
7566def parse_client_response (response ):
7667 """
7768 Helper to handle the response type from RSConnectClient, because
Original file line number Diff line number Diff line change 7171from .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
Original file line number Diff line number Diff line change 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
4443class 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
Original file line number Diff line number Diff line change 99import pytest
1010from 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
1414from .utils import (
1515 apply_common_args ,
@@ -561,9 +561,6 @@ def test_add_shinyapps_missing_options(self):
561561
562562class 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"
Original file line number Diff line number Diff line change 11from unittest import TestCase
22from datetime import timedelta
33
4- from rsconnect .json_web_token import is_jwt_compatible_python_version
5-
64from rsconnect .json_web_token import JWTEncoder
75
86from tests .utils import (
1210
1311
1412class 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"
You can’t perform that action at this time.
0 commit comments