From c86e252a9b369246a5543cad610f89f6b47ddbce Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 12 Aug 2014 07:09:40 +0200 Subject: [PATCH] Change tests to use is_url instead of _is_url_naive. --- qutebrowser/test/utils/test_url.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/qutebrowser/test/utils/test_url.py b/qutebrowser/test/utils/test_url.py index 860c68d16..889829be6 100644 --- a/qutebrowser/test/utils/test_url.py +++ b/qutebrowser/test/utils/test_url.py @@ -112,9 +112,10 @@ class SearchUrlTests(unittest.TestCase): urlutils.config = self.config -class IsUrlNaiveTests(unittest.TestCase): +@unittest.mock.patch('qutebrowser.utils.url.config.get', autospec=True) +class IsUrlTests(unittest.TestCase): - """Tests for _is_url_naive. + """Tests for is_url. Class attributes: URLS: A list of strings which are URLs. @@ -134,17 +135,19 @@ class IsUrlNaiveTests(unittest.TestCase): 'foo', ) - def test_urls(self): + def test_urls(self, configmock): """Test things which are URLs.""" + configmock.return_value = 'naive' for url in self.URLS: with self.subTest(url=url): - self.assertTrue(urlutils._is_url_naive(url), url) + self.assertTrue(urlutils.is_url(url), url) - def test_not_urls(self): + def test_not_urls(self, configmock): """Test things which are not URLs.""" + configmock.return_value = 'naive' for url in self.NOT_URLS: with self.subTest(url=url): - self.assertFalse(urlutils._is_url_naive(url), url) + self.assertFalse(urlutils.is_url(url), url) if __name__ == '__main__':