Merge pull request #1306 from alphagov/roll-up-inbox

Roll up messages in inbox
This commit is contained in:
Chris Hill-Scott
2017-06-07 16:24:22 +01:00
committed by GitHub
6 changed files with 36 additions and 13 deletions

View File

@@ -131,11 +131,11 @@ def test_inbound_messages_shows_count_of_messages(
@pytest.mark.parametrize('index, expected_row', enumerate([
'07900900000 foo 1 hour ago',
'07900900001 foo 2 hours ago',
'07900900002 foo 3 hours ago',
'07900900003 foo 4 hours ago',
'07900900004 foo 5 hours ago',
'07900 900000 message-1 1 hour ago',
'07900 900002 message-4 3 hours ago',
'07900 900004 message-5 5 hours ago',
'07900 900006 message-6 7 hours ago',
'07900 900008 message-7 9 hours ago',
]))
def test_inbox_showing_inbound_messages(
logged_in_client,
@@ -159,6 +159,9 @@ def test_inbox_showing_inbound_messages(
rows = page.select('tbody tr')
assert len(rows) == 5
assert normalize_spaces(rows[index].text) == expected_row
assert normalize_spaces(page.select('.table-show-more-link')) == (
'8 messages from 5 users'
)
def test_empty_inbox(

View File

@@ -1139,9 +1139,9 @@ def mock_get_inbound_sms(mocker):
):
return [{
'user_number': '0790090000' + str(i),
'content': 'foo',
'content': 'message-{}'.format(index + 1),
'created_at': (datetime.utcnow() - timedelta(minutes=60 * (i + 1))).isoformat()
} for i in range(5)]
} for index, i in enumerate([0, 0, 0, 2, 4, 6, 8, 8])]
return mocker.patch(
'app.service_api_client.get_inbound_sms',