'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.load_activated_callbacks = {}
    self.load_deactivated_callbacks = {}
    def get_load_name(number):
        return ('Mock    Load    #' + str(number))
    def on_load_activated(number, callback):
        self.load_activated_callbacks[number] = callback
    def on_load_deactivated(number, callback):
        self.load_deactivated_callbacks[number] = callback
    self.mock_lj = mock_pylitejet.return_value
    self.mock_lj.loads.return_value = range(1, 3)
    self.mock_lj.button_switches.return_value = range(0)
    self.mock_lj.all_switches.return_value = range(0)
    self.mock_lj.scenes.return_value = range(0)
    self.mock_lj.get_load_level.return_value = 0
    self.mock_lj.get_load_name.side_effect = get_load_name
    self.mock_lj.on_load_activated.side_effect = on_load_activated
    self.mock_lj.on_load_deactivated.side_effect = on_load_deactivated
    assert setup.setup_component(self.hass, litejet.DOMAIN, {'litejet': {'port': '/tmp/this_will_be_mocked'}})
    self.hass.block_till_done()
    self.mock_lj.get_load_level.reset_mock()
