diff --git a/docs/changelog.rst b/docs/changelog.rst index ef0c85b4..48ca9ff7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -42,8 +42,8 @@ Models Utils ----- -- Add :func:`mopidy.utils.http.format_proxy` and - :func:`mopidy.utils.http.format_user_agent`. (Part of: :issue:`1156`) +- Add :func:`mopidy.httpclient.format_proxy` and + :func:`mopidy.httpclient.format_user_agent`. (Part of: :issue:`1156`) Internal changes ---------------- diff --git a/mopidy/audio/utils.py b/mopidy/audio/utils.py index 6266b64f..3b9ea30f 100644 --- a/mopidy/audio/utils.py +++ b/mopidy/audio/utils.py @@ -8,9 +8,8 @@ import pygst pygst.require('0.10') import gst # noqa -from mopidy import compat +from mopidy import compat, httpclient from mopidy.models import Album, Artist, Track -from mopidy.utils import http logger = logging.getLogger(__name__) @@ -143,7 +142,7 @@ def setup_proxy(element, config): if not hasattr(element.props, 'proxy') or not config.get('hostname'): return - element.set_property('proxy', http.format_proxy(config, auth=False)) + element.set_property('proxy', httpclient.format_proxy(config, auth=False)) element.set_property('proxy-id', config.get('username')) element.set_property('proxy-pw', config.get('password')) diff --git a/mopidy/utils/http.py b/mopidy/httpclient.py similarity index 100% rename from mopidy/utils/http.py rename to mopidy/httpclient.py diff --git a/tests/utils/test_http.py b/tests/test_httpclient.py similarity index 84% rename from tests/utils/test_http.py rename to tests/test_httpclient.py index 4553dc05..4497ceda 100644 --- a/tests/utils/test_http.py +++ b/tests/test_httpclient.py @@ -4,7 +4,7 @@ import re import pytest -from mopidy.utils import http +from mopidy.utils import httpclient @pytest.mark.parametrize("config,expected", [ @@ -20,12 +20,12 @@ from mopidy.utils import http 'http://user:pass@proxy.lan:80'), ]) def test_format_proxy(config, expected): - assert http.format_proxy(config) == expected + assert httpclient.format_proxy(config) == expected def test_format_proxy_without_auth(): config = {'username': 'user', 'password': 'pass', 'hostname': 'proxy.lan'} - formated_proxy = http.format_proxy(config, auth=False) + formated_proxy = httpclient.format_proxy(config, auth=False) assert formated_proxy == 'http://proxy.lan:80' @@ -35,4 +35,4 @@ def test_format_proxy_without_auth(): ('Foo/1.2.3', r'^Foo/1.2.3 Mopidy/[^ ]+ CPython|/[^ ]+$'), ]) def test_format_user_agent(name, expected): - assert re.match(expected, http.format_user_agent(name)) + assert re.match(expected, httpclient.format_user_agent(name))