'Setup things to be run when tests are started.'

@mock.patch('pylitejet.LiteJet')
def setup_method(self, method, mock_pylitejet):

    self.hass = get_test_home_assistant()
    self.hass.start()
    self.switch_pressed_callbacks = {}
    self.switch_released_callbacks = {}
    def get_switch_name(number):
        return ('Mock    Switch    #' + str(number))
    def on_switch_pressed(number, callback):
        self.switch_pressed_callbacks[number] = callback
    def on_switch_released(number, callback):
        self.switch_released_callbacks[number] = callback
    self.mock_lj = mock_pylitejet.return_value
    self.mock_lj.loads.return_value = range(0)
    self.mock_lj.button_switches.return_value = range(1, 3)
    self.mock_lj.all_switches.return_value = range(1, 6)
    self.mock_lj.scenes.return_value = range(0)
    self.mock_lj.get_switch_name.side_effect = get_switch_name
    self.mock_lj.on_switch_pressed.side_effect = on_switch_pressed
    self.mock_lj.on_switch_released.side_effect = on_switch_released
    config = {'litejet': {'port': '/tmp/this_will_be_mocked'}}
    if (method == self.test_include_switches_False):
        config['litejet']['include_switches'] = False
    elif (method != self.test_include_switches_unspecified):
        config['litejet']['include_switches'] = True
    assert setup.setup_component(self.hass, litejet.DOMAIN, config)
    self.hass.block_till_done()
