def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.name = "foo" self.method = "post" self.resource = "http://localhost/" self.state_resource = self.resource self.headers = {"Content-type": CONTENT_TYPE_JSON} self.auth = None self.body_on = Template("on", self.hass) self.body_off = Template("off", self.hass) self.switch = rest.RestSwitch( self.name, self.resource, self.state_resource, self.method, self.headers, self.auth, self.body_on, self.body_off, None, 10, True, ) self.switch.hass = self.hass
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.name = 'foo' self.method = 'post' self.resource = 'http://localhost/' self.headers = {'Content-type': 'application/json'} self.auth = None self.body_on = Template('on', self.hass) self.body_off = Template('off', self.hass) self.switch = rest.RestSwitch(self.name, self.resource, self.method, self.headers, self.auth, self.body_on, self.body_off, None, 10, True) self.switch.hass = self.hass
def _setup_test_switch(hass): body_on = Template("on", hass) body_off = Template("off", hass) switch = rest.RestSwitch( NAME, RESOURCE, STATE_RESOURCE, METHOD, HEADERS, AUTH, body_on, body_off, None, 10, True, ) switch.hass = hass return switch, body_on, body_off
def _setup_test_switch(hass): body_on = Template("on", hass) body_off = Template("off", hass) headers = {"Content-type": Template(CONTENT_TYPE_JSON, hass)} switch = rest.RestSwitch( NAME, DEVICE_CLASS, RESOURCE, STATE_RESOURCE, METHOD, headers, PARAMS, AUTH, body_on, body_off, None, 10, True, ) switch.hass = hass return switch, body_on, body_off
def _setup_test_switch(hass): body_on = Template("on", hass) body_off = Template("off", hass) headers = {"Content-type": Template(CONTENT_TYPE_JSON, hass)} switch = rest.RestSwitch( hass, { CONF_NAME: Template(NAME, hass), CONF_DEVICE_CLASS: DEVICE_CLASS, CONF_RESOURCE: RESOURCE, rest.CONF_STATE_RESOURCE: STATE_RESOURCE, rest.CONF_METHOD: METHOD, rest.CONF_HEADERS: headers, rest.CONF_PARAMS: PARAMS, rest.CONF_BODY_ON: body_on, rest.CONF_BODY_OFF: body_off, rest.CONF_IS_ON_TEMPLATE: None, rest.CONF_TIMEOUT: 10, rest.CONF_VERIFY_SSL: True, }, None, ) switch.hass = hass return switch, body_on, body_off