@@ -340,7 +340,7 @@ def test_access_http_auth(settings):
340340 items , url , crawler = yield crawl_items (LuaSpider , HelloWorldProtected ,
341341 settings , kwargs )
342342 response = assert_single_response (items )
343- assert 'hello' in response .body_as_unicode ()
343+ assert 'hello' in response .text
344344 assert response .status == 200
345345 assert response .splash_response_status == 200
346346
@@ -351,8 +351,8 @@ def test_protected_splash_no_auth(settings_auth):
351351 items , url , crawler = yield crawl_items (LuaSpider , HelloWorld ,
352352 settings_auth )
353353 response = assert_single_response (items )
354- assert 'Unauthorized' in response .body_as_unicode ()
355- assert 'hello' not in response .body_as_unicode ()
354+ assert 'Unauthorized' in response .text
355+ assert 'hello' not in response .text
356356 assert response .status == 401
357357 assert response .splash_response_status == 401
358358
@@ -367,15 +367,15 @@ def test_protected_splash_manual_headers_auth(settings_auth):
367367 items , url , crawler = yield crawl_items (LuaSpider , HelloWorld ,
368368 settings_auth , kwargs )
369369 response = assert_single_response (items )
370- assert 'hello' in response .body_as_unicode ()
370+ assert 'hello' in response .text
371371 assert response .status == 200
372372 assert response .splash_response_status == 200
373373
374374 # but only for Splash, not for a remote website
375375 items , url , crawler = yield crawl_items (LuaSpider , HelloWorldProtected ,
376376 settings_auth , kwargs )
377377 response = assert_single_response (items )
378- assert 'hello' not in response .body_as_unicode ()
378+ assert 'hello' not in response .text
379379 assert response .status == 401
380380 assert response .splash_response_status == 200
381381
@@ -390,8 +390,8 @@ def test_protected_splash_settings_auth(settings_auth):
390390 items , url , crawler = yield crawl_items (LuaSpider , HelloWorld ,
391391 settings_auth )
392392 response = assert_single_response (items )
393- assert 'Unauthorized' not in response .body_as_unicode ()
394- assert 'hello' in response .body_as_unicode ()
393+ assert 'Unauthorized' not in response .text
394+ assert 'hello' in response .text
395395 assert response .status == 200
396396 assert response .splash_response_status == 200
397397
@@ -418,7 +418,7 @@ def test_protected_splash_settings_auth(settings_auth):
418418 response = assert_single_response (items )
419419 assert response .status == 200
420420 assert response .splash_response_status == 200
421- assert 'hello' in response .body_as_unicode ()
421+ assert 'hello' in response .text
422422
423423 # enable remote auth, but not splash auth - request should fail
424424 del settings_auth ['SPLASH_USER' ]
@@ -439,8 +439,8 @@ def test_protected_splash_httpauth_middleware(settings_auth):
439439 items , url , crawler = yield crawl_items (ScrapyAuthSpider , HelloWorld ,
440440 settings_auth )
441441 response = assert_single_response (items )
442- assert 'Unauthorized' not in response .body_as_unicode ()
443- assert 'hello' in response .body_as_unicode ()
442+ assert 'Unauthorized' not in response .text
443+ assert 'hello' in response .text
444444 assert response .status == 200
445445 assert response .splash_response_status == 200
446446
@@ -449,7 +449,7 @@ def test_protected_splash_httpauth_middleware(settings_auth):
449449 HelloWorldProtected ,
450450 settings_auth )
451451 response = assert_single_response (items )
452- assert 'hello' not in response .body_as_unicode ()
452+ assert 'hello' not in response .text
453453 assert response .status == 401
454454 assert response .splash_response_status == 200
455455
@@ -458,7 +458,7 @@ def test_protected_splash_httpauth_middleware(settings_auth):
458458 HelloWorldDisallowAuth ,
459459 settings_auth )
460460 response = assert_single_response (items )
461- assert 'hello' in response .body_as_unicode ()
461+ assert 'hello' in response .text
462462 assert response .status == 200
463463 assert response .splash_response_status == 200
464464
@@ -467,7 +467,7 @@ def test_protected_splash_httpauth_middleware(settings_auth):
467467 HelloWorldProtected ,
468468 settings_auth )
469469 response = assert_single_response (items )
470- assert 'hello' in response .body_as_unicode ()
470+ assert 'hello' in response .text
471471 assert response .status == 200
472472 assert not hasattr (response , 'splash_response_status' )
473473
0 commit comments