python3: replace json string parser input by text (#40911)
This commit is contained in:
parent
e879263277
commit
ec91ea59b1
|
@ -10,6 +10,7 @@ import pytest
|
||||||
import httmock
|
import httmock
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.utils.six.moves.urllib import parse as urlparse
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
@ -1271,7 +1272,7 @@ def test_passage_a_la_majorite(db, settings, nanterre_classic_family, freezer):
|
||||||
Job.redo(timestamp=now() + datetime.timedelta(seconds=20))
|
Job.redo(timestamp=now() + datetime.timedelta(seconds=20))
|
||||||
assert len(requests) == 1
|
assert len(requests) == 1
|
||||||
|
|
||||||
req_content = json.loads(requests[0].body)
|
req_content = json.loads(force_text(requests[0].body))
|
||||||
assert req_content['metadonnees']['service'] == 'passage-majorite'
|
assert req_content['metadonnees']['service'] == 'passage-majorite'
|
||||||
assert len(req_content['fragments']) == 3
|
assert len(req_content['fragments']) == 3
|
||||||
assert req_content['fragments'][0]['type'] == 'maj-adresse'
|
assert req_content['fragments'][0]['type'] == 'maj-adresse'
|
||||||
|
|
|
@ -4,6 +4,7 @@ import json
|
||||||
import httmock
|
import httmock
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.utils.encoding import force_text
|
||||||
|
|
||||||
from zoo.zoo_nanterre.fragments import Synchronization
|
from zoo.zoo_nanterre.fragments import Synchronization
|
||||||
from zoo.models import Job
|
from zoo.models import Job
|
||||||
|
@ -28,7 +29,7 @@ def test_synchro_full(app, nanterre_classic_family):
|
||||||
|
|
||||||
@httmock.urlmatch()
|
@httmock.urlmatch()
|
||||||
def technocarte_ok(url, request):
|
def technocarte_ok(url, request):
|
||||||
request_bodies.append(json.loads(request.body))
|
request_bodies.append(json.loads(force_text(request.body)))
|
||||||
return httmock.response(
|
return httmock.response(
|
||||||
200, [
|
200, [
|
||||||
{
|
{
|
||||||
|
@ -227,7 +228,7 @@ def test_infor(app, nanterre_classic_family):
|
||||||
|
|
||||||
@httmock.urlmatch()
|
@httmock.urlmatch()
|
||||||
def infor_ok(url, request):
|
def infor_ok(url, request):
|
||||||
request_bodies.append(json.loads(request.body))
|
request_bodies.append(json.loads(force_text(request.body)))
|
||||||
return httmock.response(
|
return httmock.response(
|
||||||
200, {
|
200, {
|
||||||
'http_code': 200,
|
'http_code': 200,
|
||||||
|
@ -276,7 +277,7 @@ def test_infor(app, nanterre_classic_family):
|
||||||
|
|
||||||
@httmock.urlmatch()
|
@httmock.urlmatch()
|
||||||
def infor_nok(url, request):
|
def infor_nok(url, request):
|
||||||
request_bodies.append(json.loads(request.body))
|
request_bodies.append(json.loads(force_text(request.body)))
|
||||||
return httmock.response(
|
return httmock.response(
|
||||||
200, {
|
200, {
|
||||||
'http_code': 500,
|
'http_code': 500,
|
||||||
|
|
Loading…
Reference in New Issue