tests: use resp.text to compare against string

This commit is contained in:
Frédéric Péters 2018-07-25 20:53:36 +02:00
parent 03cdecb644
commit 64305b1cb8
1 changed files with 3 additions and 3 deletions

View File

@ -490,7 +490,7 @@ def test_config_json_cell_additional_url(app):
url = reverse('combo-public-ajax-page-cell',
kwargs={'page_pk': page.id, 'cell_reference': cell.get_reference()})
resp = app.get(url)
assert resp.body.strip() == '/var1=/var2=/'
assert resp.text.strip() == '/var1=/var2=/'
assert len(requests_get.mock_calls) == 2
assert requests_get.mock_calls[0][1][0] == 'http://foo'
assert requests_get.mock_calls[1][1][0] == 'http://bar'
@ -543,7 +543,7 @@ def test_config_json_cell_additional_url(app):
url = reverse('combo-public-ajax-page-cell',
kwargs={'page_pk': page.id, 'cell_reference': cell.get_reference()})
resp = app.get(url)
assert resp.body.strip() == '/var1=bar/var2=bar/'
assert resp.text.strip() == '/var1=bar/var2=bar/'
assert len(requests_get.mock_calls) == 3
assert requests_get.mock_calls[0][1][0] == 'http://foo'
assert requests_get.mock_calls[0][-1]['log_errors'] == True
@ -571,7 +571,7 @@ def test_config_json_cell_additional_url(app):
url = reverse('combo-public-ajax-page-cell',
kwargs={'page_pk': page.id, 'cell_reference': cell.get_reference()})
resp = app.get(url)
assert resp.body.strip() == '/var1=/var2=/'
assert resp.text.strip() == '/var1=/var2=/'
# can not create plop and plop2 url: only one request for "json"
assert len(requests_get.mock_calls) == 2
assert requests_get.mock_calls[0][1][0] == 'http://foo'