Skip to content

Commit

Permalink
add node time to the box nodes in Main page
Browse files Browse the repository at this point in the history
  • Loading branch information
julien6387 committed Nov 20, 2021
1 parent e752013 commit b6e6605
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions supvisors/tests/test_viewsupvisors.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ def test_write_contents(mocker, view):
assert not mocked_conflict_mid.replace.called


def test_write_node_box_title(view):
def test_write_node_box_title(mocker, view):
""" Test the _write_node_box_title method. """
# patch context
mocker.patch('supvisors.viewsupvisors.simple_localtime', return_value='12:34:30')
mocked_status = Mock(node_name='10.0.0.1', state=AddressStates.RUNNING,
**{'get_loading.return_value': 17, 'get_remote_time.return_value': 1234})
view.view_ctx = Mock(**{'format_url.return_value': 'an url'})
Expand All @@ -131,7 +132,7 @@ def test_write_node_box_title(view):
assert mocked_state_mid.attrib['class'] == 'RUNNING state'
assert mocked_state_mid.content.call_args_list == [call('RUNNING')]
# test time element
assert mocked_time_mid.content.call_args_list == [call('01:20:34')]
assert mocked_time_mid.content.call_args_list == [call('12:34:30')]
# test loading element
assert mocked_percent_mid.content.call_args_list == [call('17%')]
# reset mocks and attributes
Expand All @@ -152,7 +153,7 @@ def test_write_node_box_title(view):
assert mocked_state_mid.attrib['class'] == 'RUNNING state'
assert mocked_state_mid.content.call_args_list == [call('RUNNING')]
# test time element
assert mocked_time_mid.content.call_args_list == [call('01:20:34')]
assert mocked_time_mid.content.call_args_list == [call('12:34:30')]
# test loading element
assert mocked_percent_mid.content.call_args_list == [call('17%')]
# reset mocks and attributes
Expand Down

0 comments on commit b6e6605

Please sign in to comment.