def test_setup_platform_valid_config():
    """ Should check the supplied config and call add_entities with Sensor. """
    add_entities = Mock()
    ret = bin_tcp.setup_platform(None, test_tcp.TEST_CONFIG, add_entities)
    assert ret is None, "setup_platform() should return None if successful."
    assert add_entities.called
    assert isinstance(add_entities.call_args[0][0][0], bin_tcp.BinarySensor)
Beispiel #2
0
def test_setup_platform_valid_config():
    """ Should check the supplied config and call add_entities with Sensor. """
    add_entities = Mock()
    ret = bin_tcp.setup_platform(None, test_tcp.TEST_CONFIG, add_entities)
    assert ret is None, "setup_platform() should return None if successful."
    assert add_entities.called
    assert isinstance(add_entities.call_args[0][0][0], bin_tcp.BinarySensor)
Beispiel #3
0
 def test_setup_platform_devices(self, mock_update):
     """Check the supplied config and call add_entities with sensor."""
     add_entities = Mock()
     ret = bin_tcp.setup_platform(None, test_tcp.TEST_CONFIG, add_entities)
     assert ret is None
     assert add_entities.called
     assert isinstance(
         add_entities.call_args[0][0][0], bin_tcp.TcpBinarySensor)
Beispiel #4
0
 def test_setup_platform_devices(self, mock_update):
     """Check the supplied config and call add_devices with sensor."""
     add_devices = Mock()
     ret = bin_tcp.setup_platform(None, test_tcp.TEST_CONFIG, add_devices)
     assert ret is None
     assert add_devices.called
     assert isinstance(
         add_devices.call_args[0][0][0], bin_tcp.TcpBinarySensor)
def test_setup_platform_invalid_config():
    """ Should check the supplied config and return False if it is invalid. """
    config = copy(test_tcp.TEST_CONFIG)
    del config[tcp.CONF_HOST]
    assert bin_tcp.setup_platform(None, config, None) is False
Beispiel #6
0
def test_setup_platform_invalid_config():
    """ Should check the supplied config and return False if it is invalid. """
    config = copy(test_tcp.TEST_CONFIG)
    del config[tcp.CONF_HOST]
    assert bin_tcp.setup_platform(None, config, None) is False