예제 #1
0
 def setUp(self):  # pylint: disable=invalid-name
     """Set up things to be run when tests are started."""
     login = "******"
     passwd = "testpasswd"
     recipient = "06501234567"
     client = yessssms.YesssSMS(login, passwd)
     self.yessssms = yessssms.YesssSMSNotificationService(client, recipient)
예제 #2
0
def yessssms_init():
    """Set up things to be run when tests are started."""
    login = "******"
    passwd = "testpasswd"
    recipient = "06501234567"
    client = yessssms.YesssSMS(login, passwd)
    return yessssms.YesssSMSNotificationService(client, recipient)
예제 #3
0
async def test_connection_error_on_init(hass, caplog, valid_settings, connection_error):
    """Test for connection error on init."""
    caplog.set_level(logging.DEBUG)
    await valid_settings
    assert hass.services.has_service("notify", "sms")
    for record in caplog.records:
        if (
            record.levelname == "WARNING"
            and record.name == "homeassistant.components.yessssms.notify"
        ):
            assert (
                "Connection Error, could not verify login data for 'educom'"
                in record.message
            )
    for record in caplog.records:
        if (
            record.levelname == "DEBUG"
            and record.name == "homeassistant.components.yessssms.notify"
        ):
            assert (
                "initialized; library version: {}".format(
                    yessssms.YesssSMS("", "").version()
                )
                in record.message
            )
예제 #4
0
async def test_init_success(hass, caplog, valid_settings, valid_login_data):
    """Test for successful init of yessssms."""
    await valid_settings
    assert hass.services.has_service("notify", "sms")
    messages = []
    for record in caplog.records:
        if (record.levelname == "DEBUG"
                and record.name == "homeassistant.components.yessssms.notify"):
            messages.append(record.message)
    assert "Login data for 'educom' valid" in messages[0]
    assert ("initialized; library version: {}".format(
        yessssms.YesssSMS("", "").version()) in messages[1])