<commit_before>import unittest
from unittest import mock

import mopidy.config as mopidy_config
from mopidy_musicbox_webclient import Extension
from mopidy_musicbox_webclient.webclient import Webclient


class WebclientTests(unittest.TestCase):
    def setUp(self):
        config = mopidy_config.Proxy(
            {
                "musicbox_webclient": {
                    "enabled": True,
                    "musicbox": False,
                    "websocket_host": "host_mock",
                    "websocket_port": 999,
                },
                "alarmclock": {"enabled": True,},
            }
        )

        self.ext = Extension()
        self.mmw = Webclient(config)

    def test_get_version(self):
        assert self.mmw.get_version() == self.ext.version

    def test_get_websocket_url_uses_config_file(self):
        assert (
            self.mmw.get_websocket_url(mock.Mock())
            == "ws://host_mock:999/mopidy/ws"
        )

    def test_get_websocket_url_uses_request_host(self):<commit_msg>flake8 fix<commit_after>import unittest
from unittest import mock

import mopidy.config as mopidy_config
from mopidy_musicbox_webclient import Extension
from mopidy_musicbox_webclient.webclient import Webclient


class WebclientTests(unittest.TestCase):
    def setUp(self):
        config = mopidy_config.Proxy(
            {
                "musicbox_webclient": {
                    "enabled": True,
                    "musicbox": False,
                    "websocket_host": "host_mock",
                    "websocket_port": 999,
                },
                "alarmclock": {"enabled": True},
            }
        )

        self.ext = Extension()
        self.mmw = Webclient(config)

    def test_get_version(self):
        assert self.mmw.get_version() == self.ext.version

    def test_get_websocket_url_uses_config_file(self):
        assert (
            self.mmw.get_websocket_url(mock.Mock())
            == "ws://host_mock:999/mopidy/ws"
        )

    def test_get_websocket_url_uses_request_host(self):
{'fraction_non_alphanumeric': 0.0928988326848249, 'fraction_numerical': 0.00632295719844358, 'mean_word_length': 2.0610119047619047, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1516486', 'n_tokens_mistral': 651, 'n_tokens_neox': 598, 'n_words': 104}