summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-01-19 18:32:30 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-03-17 18:06:44 (GMT)
commite2eb510f8708d441accf205b02175b42e501f180 (patch)
treef0df354d16cdbd8e6dd5faa96517e3d3b4bf73c9
parent9a5edc0b00a0b66ed19b4e33ce6d91f506caedfd (diff)
downloadwelco-e2eb510f8708d441accf205b02175b42e501f180.zip
welco-e2eb510f8708d441accf205b02175b42e501f180.tar.gz
welco-e2eb510f8708d441accf205b02175b42e501f180.tar.bz2
python3: update maarch tests (#39092)
-rw-r--r--tests/test_source_maarch.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_source_maarch.py b/tests/test_source_maarch.py
index 85fc0ed..2d908d4 100644
--- a/tests/test_source_maarch.py
+++ b/tests/test_source_maarch.py
@@ -19,6 +19,7 @@ import json
import pytest
from django.contrib.auth.models import User
+from django.utils.encoding import force_text
from httmock import urlmatch, HTTMock
@@ -56,6 +57,7 @@ class MaarchMock(BaseMock):
'headers': {
'content-type': 'application/json',
},
+ 'status_code': 200,
}
list_endpoint.path = '^/rest/res/list$'
@@ -71,6 +73,7 @@ class MaarchMock(BaseMock):
'headers': {
'content-type': 'application/json',
},
+ 'status_code': 200,
}
update_status.path = '^/rest/res/resource/status$'
@@ -152,7 +155,7 @@ def test_utils(maarch):
assert welco_maarch_obj.grc_refused_status == 'GRCREFUSED'
-PDF_MOCK = '%PDF-1.4 ...'
+PDF_MOCK = b'%PDF-1.4 ...'
def test_feed(settings, app, maarch, wcs, user):
@@ -173,7 +176,7 @@ def test_feed(settings, app, maarch, wcs, user):
'resources': [
{
'res_id': 1,
- 'fileBase64Content': base64.b64encode(PDF_MOCK),
+ 'fileBase64Content': force_text(base64.b64encode(PDF_MOCK)),
}
],
})
@@ -250,7 +253,7 @@ def test_feed(settings, app, maarch, wcs, user):
user.set_password('test')
user.save()
# verify authentication error
- response = app.post_json('/api/mail/response/', params={}, status=403)
+ response = app.post_json('/api/mail/response/', params={}, status=(401, 403))
app.authorization = ('Basic', ('test', 'test'))
# verify serializer error
response = app.post_json('/api/mail/response/', params={}, status=400)