diff --git a/scrapy/trunk/scrapy/tests/test_utils_response.py b/scrapy/trunk/scrapy/tests/test_utils_response.py index 2e86baf1e..701bf60ea 100644 --- a/scrapy/trunk/scrapy/tests/test_utils_response.py +++ b/scrapy/trunk/scrapy/tests/test_utils_response.py @@ -1,20 +1,20 @@ import unittest from scrapy.http.response import Response -from scrapy.utils.response import body_or_str +from scrapy.utils.response import body_or_str, get_base_url class ResponseUtilsTest(unittest.TestCase): dummy_response = Response(url='http://example.org/', body='dummy_response') - def test_input(self): + def test_body_or_str_input(self): self.assertTrue(isinstance(body_or_str(self.dummy_response), basestring)) self.assertTrue(isinstance(body_or_str('text'), basestring)) self.assertRaises(Exception, body_or_str, 2) - def test_extraction(self): + def test_body_or_str_extraction(self): self.assertEqual(body_or_str(self.dummy_response), 'dummy_response') self.assertEqual(body_or_str('text'), 'text') - def test_encoding(self): + def test_body_or_str_encoding(self): self.assertTrue(isinstance(body_or_str(self.dummy_response, unicode=False), str)) self.assertTrue(isinstance(body_or_str(self.dummy_response, unicode=True), unicode)) @@ -24,5 +24,14 @@ class ResponseUtilsTest(unittest.TestCase): self.assertTrue(isinstance(body_or_str(u'text', unicode=False), str)) self.assertTrue(isinstance(body_or_str(u'text', unicode=True), unicode)) + def test_get_base_url(self): + response = Response(url='http://example.org', body="""\ + \ +