flavors / django-graphql-jwt

JSON Web Token (JWT) authentication for Graphene Django

Home Page:https://django-graphql-jwt.domake.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests fails in year 2038

bmwiedemann opened this issue · comments

While working on reproducible builds for openSUSE, I found that
our python-django-graphql-jwt 0.3.4 package fails to build in 2038, because several tests fail.

To reproduce:

osc checkout openSUSE:Factory/python-django-graphql-jwt && cd $_
osc build --vm-type=kvm --noservice --clean --build-opt=--vm-custom-opt="-rtc base=2038-01-19T06:00:00" standard

log:

[...]
 _____________________ CookieTokenAuthTests.test_token_auth _____________________
 
 self = <tests.refresh_token.test_relay.CookieTokenAuthTests testMethod=test_token_auth>
 
     @override_jwt_settings(JWT_LONG_RUNNING_REFRESH_TOKEN=True)
     def test_token_auth(self):
         with catch_signal(token_issued) as token_issued_handler:
             response = self.execute(
                 {
                     self.user.USERNAME_FIELD: self.user.get_username(),
                     "password": "dolphins",
                 }
             )
     
         data = response.data["tokenAuth"]
         token = response.cookies.get(
             jwt_settings.JWT_REFRESH_TOKEN_COOKIE_NAME,
         ).value
     
         self.assertEqual(token_issued_handler.call_count, 1)
     
 >       self.assertIsNone(response.errors)
 E       AssertionError: [{'message': 'Int cannot represent non 32-bit signed integer value: 2148098416.0', 'locations': [{'line': 7, 'column': 9}], 'path': ['tokenAuth', 'refreshExpiresIn']}] is not None
 
 tests/refresh_token/mixins.py:159: AssertionError
 ____________________ CookieRefreshTests.test_refresh_token _____________________
 
 self = <tests.refresh_token.test_relay.CookieRefreshTests testMethod=test_refresh_token>
 
     def test_refresh_token(self):
         self.set_refresh_token_cookie()
     
         with catch_signal(
             refresh_token_rotated
         ) as refresh_token_rotated_handler, back_to_the_future(seconds=1):
     
             response = self.execute()
     
         data = response.data["refreshToken"]
 >       token = data["token"]
 E       TypeError: 'NoneType' object is not subscriptable
 
 tests/refresh_token/mixins.py:175: TypeError
 =============================== warnings summary ===============================
 ../../../../../usr/lib/python3.9/site-packages/django/conf/__init__.py:241
   /usr/lib/python3.9/site-packages/django/conf/__init__.py:241: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.
     warnings.warn(
 
 -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
 =========================== short test summary info ============================
 FAILED tests/test_mutations.py::TokenAuthTests::test_token_auth - AssertionEr...
 FAILED tests/test_mutations.py::RefreshTests::test_refresh - TypeError: 'None...
 FAILED tests/test_mutations.py::CookieTokenAuthTests::test_token_auth - Asser...
 FAILED tests/test_mutations.py::CookieRefreshTests::test_refresh - TypeError:...
 FAILED tests/test_relay.py::TokenAuthTests::test_token_auth - AssertionError:...
 FAILED tests/test_relay.py::RefreshTests::test_refresh - TypeError: 'NoneType...
 FAILED tests/test_relay.py::CookieTokenAuthTests::test_token_auth - Assertion...
 FAILED tests/test_relay.py::CookieRefreshTests::test_refresh - TypeError: 'No...
 FAILED tests/refresh_token/test_mutations.py::TokenAuthTests::test_token_auth
 FAILED tests/refresh_token/test_mutations.py::RefreshTests::test_refresh_token
 FAILED tests/refresh_token/test_mutations.py::RefreshTests::test_reuse_refresh_token
 FAILED tests/refresh_token/test_mutations.py::CookieTokenAuthTests::test_token_auth
 FAILED tests/refresh_token/test_mutations.py::CookieRefreshTests::test_refresh_token
 FAILED tests/refresh_token/test_relay.py::TokenAuthTests::test_token_auth - T...
 FAILED tests/refresh_token/test_relay.py::RefreshTokenTests::test_refresh_token
 FAILED tests/refresh_token/test_relay.py::RefreshTokenTests::test_reuse_refresh_token
 FAILED tests/refresh_token/test_relay.py::CookieTokenAuthTests::test_token_auth
 FAILED tests/refresh_token/test_relay.py::CookieRefreshTests::test_refresh_token
 =========== 18 failed, 94 passed, 1 deselected, 1 warning in 10.80s ============