py3: force text on b64-encoded test data (#41220)
This commit is contained in:
parent
f9f427321d
commit
b879ada6b8
|
@ -5,6 +5,8 @@ import uuid
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
from authentic2_cut import models
|
from authentic2_cut import models
|
||||||
|
|
||||||
from utils import login
|
from utils import login
|
||||||
|
@ -53,7 +55,7 @@ def helper_test_validation_image(glc_app, john, image_file, extension):
|
||||||
response = glc_app.post_json('/api/users/%s/validate/' % john._oidc_sub, params={
|
response = glc_app.post_json('/api/users/%s/validate/' % john._oidc_sub, params={
|
||||||
'external_id': external_id,
|
'external_id': external_id,
|
||||||
'justificatifs': [{
|
'justificatifs': [{
|
||||||
'b64_content': base64.b64encode(image_file),
|
'b64_content': force_text(base64.b64encode(image_file)),
|
||||||
}],
|
}],
|
||||||
}, status=201)
|
}, status=201)
|
||||||
assert response.json == {
|
assert response.json == {
|
||||||
|
@ -97,13 +99,13 @@ def test_many_attachments(app, admin, glc_app, john, png_file, jpeg_file, pdf_fi
|
||||||
'external_id': external_id,
|
'external_id': external_id,
|
||||||
'justificatifs': [
|
'justificatifs': [
|
||||||
{
|
{
|
||||||
'b64_content': base64.b64encode(png_file),
|
'b64_content': force_text(base64.b64encode(png_file)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'b64_content': base64.b64encode(jpeg_file),
|
'b64_content': force_text(base64.b64encode(jpeg_file)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'b64_content': base64.b64encode(pdf_file),
|
'b64_content': force_text(base64.b64encode(pdf_file)),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, status=201)
|
}, status=201)
|
||||||
|
|
Loading…
Reference in New Issue