async def test_amazon_shipped_order_exception(hass, mock_imap_amazon_shipped, caplog): with patch("quopri.decodestring", side_effect=ValueError): get_items(mock_imap_amazon_shipped, "order") assert "Problem decoding email message:" in caplog.text
async def test_amazon_shipped_order_it(hass, mock_imap_amazon_shipped_it): result = get_items(mock_imap_amazon_shipped_it, "order") assert result == ["405-5236882-9395563"]
async def test_amazon_shipped_order_uk(hass, mock_imap_amazon_shipped_uk): result = get_items(mock_imap_amazon_shipped_uk, "order") assert result == ["123-4567890-1234567"]
async def test_amazon_shipped_order_alt_timeformat( hass, mock_imap_amazon_shipped_alt_timeformat ): result = get_items(mock_imap_amazon_shipped_alt_timeformat, "order") assert result == ["321-1234567-1234567"]
async def test_amazon_shipped_order_alt(hass, mock_imap_amazon_shipped_alt): result = get_items(mock_imap_amazon_shipped_alt, "order") assert result == ["123-1234567-1234567"]
async def test_amazon_shipped_count(hass, mock_imap_amazon_shipped): with patch("datetime.date") as mock_date: mock_date.today.return_value = date(2020, 9, 11) result = get_items(mock_imap_amazon_shipped, "count") assert result == 6