jpvanhal / flask-basicauth

HTTP basic access authentication for Flask.
https://flask-basicauth.readthedocs.io/
Other
85 stars 27 forks source link

tests failure: `AssertionError: 401 != 200` and `AssertionError: b'' != b'This view always requires authentication.'` #32

Open sandrotosi opened 7 months ago

sandrotosi commented 7 months ago

Hello, this has been reported in Debian as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064764, when running tests with flask-basicauth/0.2.0 i got these errors:

python3.12 -m unittest -v test_basicauth.py;  python3.11 -m unittest -v test_basicauth.py;
test_asks_for_authentication (test_basicauth.BasicAuthTestCase.test_asks_for_authentication) ... ok
test_asks_for_authentication_with_custom_realm (test_basicauth.BasicAuthTestCase.test_asks_for_authentication_with_custom_realm) ... ok
test_check_credentials_with_correct_credentials (test_basicauth.BasicAuthTestCase.test_check_credentials_with_correct_credentials) ... ok
test_check_credentials_with_incorrect_credentials (test_basicauth.BasicAuthTestCase.test_check_credentials_with_incorrect_credentials) ... ok
test_requires_authentication_for_all_views_when_forced (test_basicauth.BasicAuthTestCase.test_requires_authentication_for_all_views_when_forced) ... ok
test_responds_with_200_with_correct_credentials (test_basicauth.BasicAuthTestCase.test_responds_with_200_with_correct_credentials) ... FAIL
test_responds_with_200_with_correct_credentials_containing_colon (test_basicauth.BasicAuthTestCase.test_responds_with_200_with_correct_credentials_containing_colon) ... FAIL
test_responds_with_401_with_incorrect_credentials (test_basicauth.BasicAuthTestCase.test_responds_with_401_with_incorrect_credentials) ... ok
test_responds_with_401_without_authorization (test_basicauth.BasicAuthTestCase.test_responds_with_401_without_authorization) ... ok
test_runs_decorated_view_after_authentication (test_basicauth.BasicAuthTestCase.test_runs_decorated_view_after_authentication) ... FAIL
test_sets_default_values_for_configuration (test_basicauth.BasicAuthTestCase.test_sets_default_values_for_configuration) ... ok
test_views_without_basic_auth_decorator_respond_with_200 (test_basicauth.BasicAuthTestCase.test_views_without_basic_auth_decorator_respond_with_200) ... ok

======================================================================
FAIL: test_responds_with_200_with_correct_credentials (test_basicauth.BasicAuthTestCase.test_responds_with_200_with_correct_credentials)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/flask-basicauth-0.2.0/test_basicauth.py", line 96, in test_responds_with_200_with_correct_credentials
    self.assertEqual(response.status_code, 200)
AssertionError: 401 != 200

======================================================================
FAIL: test_responds_with_200_with_correct_credentials_containing_colon (test_basicauth.BasicAuthTestCase.test_responds_with_200_with_correct_credentials_containing_colon)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/flask-basicauth-0.2.0/test_basicauth.py", line 104, in test_responds_with_200_with_correct_credentials_containing_colon
    self.assertEqual(response.status_code, 200)
AssertionError: 401 != 200

======================================================================
FAIL: test_runs_decorated_view_after_authentication (test_basicauth.BasicAuthTestCase.test_runs_decorated_view_after_authentication)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/flask-basicauth-0.2.0/test_basicauth.py", line 111, in test_runs_decorated_view_after_authentication
    self.assertEqual(
AssertionError: b'' != b'This view always requires authentication.'

----------------------------------------------------------------------
Ran 12 tests in 0.024s

FAILED (failures=3)

this happens with both python 3.11 and 3.12; full build logs flask-basicauth_0.2.0-4_amd64.build.txt