From 52d7a5693fc74a7e7ac0191802e353b86f2ed69f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 1 Aug 2015 13:47:42 +0200 Subject: [PATCH] Fix lint. --- qutebrowser/browser/network/networkmanager.py | 3 ++- tests/utils/test_urlutils.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/network/networkmanager.py b/qutebrowser/browser/network/networkmanager.py index 08f3dcf48..d4d62bb91 100644 --- a/qutebrowser/browser/network/networkmanager.py +++ b/qutebrowser/browser/network/networkmanager.py @@ -346,7 +346,8 @@ class NetworkManager(QNetworkAccessManager): # Note: using ''.encode('ascii') sends a header with no value, # instead of no header at all req.setRawHeader('Referer'.encode('ascii'), QByteArray()) - elif (referer_header_conf== 'same-domain' and current_url.isValid() and + elif (referer_header_conf == 'same-domain' and + current_url.isValid() and not urlutils.same_domain(req.url(), current_url)): req.setRawHeader('Referer'.encode('ascii'), QByteArray()) # If refer_header_conf is set to 'always', we leave the header alone as diff --git a/tests/utils/test_urlutils.py b/tests/utils/test_urlutils.py index ed72c4b43..fa1cfa665 100644 --- a/tests/utils/test_urlutils.py +++ b/tests/utils/test_urlutils.py @@ -512,7 +512,7 @@ def test_fuzzy_url_error(url, raising, has_err_string): (False, 'http://one.not_a_valid_tld', 'http://two.not_a_valid_tld'), ]) def test_same_domain(are_same, url1, url2): - """Tests for same_domain.""" + """Test same_domain.""" assert urlutils.same_domain(QUrl(url1), QUrl(url2)) == are_same assert urlutils.same_domain(QUrl(url2), QUrl(url1)) == are_same @@ -521,6 +521,6 @@ def test_same_domain(are_same, url1, url2): ('', 'http://example.com'), ]) def test_same_domain_invalid_url(url1, url2): - """Tests with invalid URLs for same_domain.""" + """Test same_domain with invalid URLs.""" with pytest.raises(ValueError): urlutils.same_domain(QUrl(url1), QUrl(url2))