Ejemplo n.º 1
0
def test_update_activity_status(mocker):
    """
    Ensure that the activity to be shown in the activity status bar will be passed to the top pane
    with the duration of seconds provided.
    """
    w = Window()
    w.top_pane = mocker.MagicMock()
    w.update_activity_status(message='test message', duration=123)
    w.top_pane.update_activity_status.assert_called_once_with('test message', 123)
Ejemplo n.º 2
0
def test_update_activity_status_default(mocker):
    """
    Ensure that the activity to be shown in the activity status bar will be passed to the top pane
    with a default duration of 0 seconds, i.e. forever.
    """
    w = Window()
    w.top_pane = mocker.MagicMock()
    w.update_activity_status(message='test message')
    w.top_pane.update_activity_status.assert_called_once_with('test message', 0)
Ejemplo n.º 3
0
def test_show_last_sync_no_sync(mocker):
    """
    If there's no value to display, default to a "waiting" message.
    """
    w = Window()
    w.update_activity_status = mocker.MagicMock()
    w.show_last_sync(None)
    w.update_activity_status.assert_called_once_with('Last Refresh: never')
Ejemplo n.º 4
0
def test_show_last_sync(mocker):
    """
    If there's a value display the result of its "humanize" method.humanize
    """
    w = Window()
    w.update_activity_status = mocker.MagicMock()
    updated_on = mocker.MagicMock()
    w.show_last_sync(updated_on)
    w.update_activity_status.assert_called_once_with(
        'Last Refresh: {}'.format(updated_on.humanize()))