Exemple #1
0
def test_get_state_no_id():
    mock_cmd_ch = Mock()
    mock_cmd_ch.get_command.return_value = None
    cmd_id = "some_command_id"
    under_test = CommandHandler(mock_cmd_ch, cmd_id)
    assert under_test.get_state() == CommandState.UNKNOWN
    mock_cmd_ch.get_command.assert_called_once_with(cmd_id)
Exemple #2
0
def test_get_state_with_id():
    mock_cmd_ch = Mock()
    job_id = "some_job_id"
    cmd_id = "some_command_id"
    stand_in_status = CommandStatus(job_id, cmd_id)
    mock_cmd_ch.get_command.return_value = stand_in_status
    under_test = CommandHandler(mock_cmd_ch, cmd_id)
    assert under_test.get_state() == stand_in_status.state
    mock_cmd_ch.get_command.assert_called_once_with(cmd_id)