tests: change expected http error on authentication failure (#81376)
gitea/petale/pipeline/head This commit looks good Details

Previous expectation of a 403 status code was dependant upon
django-webtest preprending its own django-rest-framework authentication
backend in the settings, this behaviour changed in django-webtest
1.9.11. Previously the tests were testing the behaviour of
django-webtest more than the one from petale.
This commit is contained in:
Benjamin Dauvergne 2023-09-20 11:07:58 +02:00
parent cdca28ab46
commit df316ade0a
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ pytestmark = pytest.mark.django_db
def test_authentication_failure(app):
resp = app.get('/api/partner/12345abcde12345abcde12345abcde12/', status=403)
resp = app.get('/api/partner/12345abcde12345abcde12345abcde12/', status=401)
json.loads(resp.text)
@ -362,7 +362,7 @@ def test_idp_based_partner_authentication(mocked_post, app, cut_kevin_uuid, acl)
# failure
response = {'result': 0, 'errors': ['Invalid username/password.']}
mocked_post.return_value = FakedResponse(content=json.dumps(response))
app.put_json(url, params=payload, status=403, headers={'If-None-Match': '*'})
app.put_json(url, params=payload, status=401, headers={'If-None-Match': '*'})
response = {'result': 1, 'errors': []}
# test with RP
client_id = client_secret = 'a1b2' * 8