'Test turn_on when error status returned.'

def test_turn_on_status_not_ok(self, aioclient_mock):

    aioclient_mock.post(self.resource, status=500)
    run_coroutine_threadsafe(self.switch.async_turn_on(), self.hass.loop).result()
    assert (self.body_on.template == aioclient_mock.mock_calls[(-1)][2].decode())
    assert (self.switch.is_on is None)
