mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
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 %
This commit is contained in:
parent
af70054692
commit
19ee3c42b6
@ -31,10 +31,12 @@ class DemoMailbox(Mailbox):
|
|||||||
"""Initialize Demo mailbox."""
|
"""Initialize Demo mailbox."""
|
||||||
super().__init__(hass, name)
|
super().__init__(hass, name)
|
||||||
self._messages = {}
|
self._messages = {}
|
||||||
|
txt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
|
||||||
for idx in range(0, 10):
|
for idx in range(0, 10):
|
||||||
msgtime = int(dt.as_timestamp(
|
msgtime = int(dt.as_timestamp(
|
||||||
dt.utcnow()) - 3600 * 24 * (10 - idx))
|
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()
|
msgsha = sha1(msgtxt.encode('utf-8')).hexdigest()
|
||||||
msg = {"info": {"origtime": msgtime,
|
msg = {"info": {"origtime": msgtime,
|
||||||
"callerid": "John Doe <212-555-1212>",
|
"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):
|
def test_get_media_from_mailbox(mock_http_client):
|
||||||
"""Get audio from mailbox."""
|
"""Get audio from mailbox."""
|
||||||
mp3sha = "3f67c4ea33b37d1710f772a26dd3fb43bb159d50"
|
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()
|
msgsha = sha1(msgtxt.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
url = "/api/mailbox/media/DemoMailbox/%s" % (msgsha)
|
url = "/api/mailbox/media/DemoMailbox/%s" % (msgsha)
|
||||||
@ -60,8 +61,10 @@ def test_get_media_from_mailbox(mock_http_client):
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_delete_from_mailbox(mock_http_client):
|
def test_delete_from_mailbox(mock_http_client):
|
||||||
"""Get audio from mailbox."""
|
"""Get audio from mailbox."""
|
||||||
msgtxt1 = "This is recorded message # 1"
|
msgtxt1 = ("Message 1. "
|
||||||
msgtxt2 = "This is recorded message # 2"
|
"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()
|
msgsha1 = sha1(msgtxt1.encode('utf-8')).hexdigest()
|
||||||
msgsha2 = sha1(msgtxt2.encode('utf-8')).hexdigest()
|
msgsha2 = sha1(msgtxt2.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user