Add longer text strings to mailbox demo to test string truncation (#8893)
* Add longer text strings to mailbox demo to test string truncation in frontend * Remove lorem ipsum txt file * Use format instead of %pull/8898/head
parent
af70054692
commit
19ee3c42b6
homeassistant/components/mailbox
tests/components/mailbox
|
@ -31,10 +31,12 @@ class DemoMailbox(Mailbox):
|
|||
"""Initialize Demo mailbox."""
|
||||
super().__init__(hass, name)
|
||||
self._messages = {}
|
||||
txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
|
||||
for idx in range(0, 10):
|
||||
msgtime = int(dt.as_timestamp(
|
||||
dt.utcnow()) - 3600 * 24 * (10 - idx))
|
||||
msgtxt = "This is recorded message # %d" % (idx)
|
||||
msgtxt = "Message {}. {}".format(
|
||||
idx + 1, txt * (1 + idx * (idx % 2)))
|
||||
msgsha = sha1(msgtxt.encode('utf-8')).hexdigest()
|
||||
msg = {"info": {"origtime": msgtime,
|
||||
"callerid": "John Doe <212-555-1212>",
|
||||
|
|
|
@ -47,7 +47,8 @@ def test_get_messages_from_mailbox(mock_http_client):
|
|||
def test_get_media_from_mailbox(mock_http_client):
|
||||
"""Get audio from mailbox."""
|
||||
mp3sha = "3f67c4ea33b37d1710f772a26dd3fb43bb159d50"
|
||||
msgtxt = "This is recorded message # 1"
|
||||
msgtxt = ("Message 1. "
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ")
|
||||
msgsha = sha1(msgtxt.encode('utf-8')).hexdigest()
|
||||
|
||||
url = "/api/mailbox/media/DemoMailbox/%s" % (msgsha)
|
||||
|
@ -60,8 +61,10 @@ def test_get_media_from_mailbox(mock_http_client):
|
|||
@asyncio.coroutine
|
||||
def test_delete_from_mailbox(mock_http_client):
|
||||
"""Get audio from mailbox."""
|
||||
msgtxt1 = "This is recorded message # 1"
|
||||
msgtxt2 = "This is recorded message # 2"
|
||||
msgtxt1 = ("Message 1. "
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ")
|
||||
msgtxt2 = ("Message 3. "
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. ")
|
||||
msgsha1 = sha1(msgtxt1.encode('utf-8')).hexdigest()
|
||||
msgsha2 = sha1(msgtxt2.encode('utf-8')).hexdigest()
|
||||
|
||||
|
|
Loading…
Reference in New Issue