Пример #1
0
def test__dispatch_inapp(conf, commands):
    conf = conf()
    conf.app_dir = '/mock_dir'
    mock_func = Mock(return_value=10)
    commands.table = {'mock': (mock_func, [], 'just for testing')}
    commands.incouchapp = ['mock']
    commands.globalopts = globalopts

    assert dispatch._dispatch(['mock']) == 10
    mock_func.assert_called_with(conf, conf.app_dir)
Пример #2
0
def test__dispatch_inapp(conf, commands):
    conf = conf()
    conf.app_dir = '/mock_dir'
    mock_func = Mock(return_value=10)
    commands.table = {'mock': (mock_func, [], 'just for testing')}
    commands.incouchapp = ['mock']
    commands.globalopts = globalopts

    assert dispatch._dispatch(['mock']) == 10
    mock_func.assert_called_with(conf, conf.app_dir)
Пример #3
0
def test__dispatch_update_commands(conf, commands):
    conf = conf()
    mock_func = Mock(return_value=10)
    mock_mod = Mock()
    mock_mod.cmdtable = {'mock': (mock_func, [], 'just for testing')}
    conf.extensions = [mock_mod]
    commands.table = {}
    commands.globalopts = globalopts

    assert dispatch._dispatch(['mock']) == 10
    assert commands.table == mock_mod.cmdtable
    assert mock_func.called
Пример #4
0
def test__dispatch_update_commands(conf, commands):
    conf = conf()
    mock_func = Mock(return_value=10)
    mock_mod = Mock()
    mock_mod.cmdtable = {'mock': (mock_func, [], 'just for testing')}
    conf.extensions = [mock_mod]
    commands.table = {}
    commands.globalopts = globalopts

    assert dispatch._dispatch(['mock']) == 10
    assert commands.table == mock_mod.cmdtable
    assert mock_func.called
Пример #5
0
def test__dispatch_unknown_command():
    dispatch._dispatch(['unknown_command'])
Пример #6
0
def test__dispatch_quiet(set_logging_level):
    assert dispatch._dispatch(['-q']) == 0
    set_logging_level.assert_called_with(0)
Пример #7
0
def test__dispatch_version():
    assert dispatch._dispatch(['--version']) == 0
Пример #8
0
def test__dispatch_verbose(set_logging_level):
    assert dispatch._dispatch(['-v']) == 0
    set_logging_level.assert_called_with(1)
Пример #9
0
def test__dispatch_help():
    assert dispatch._dispatch(['-h']) == 0
Пример #10
0
def test__dispatch_debug(set_logging_level):
    assert dispatch._dispatch(['-d']) == 0
    set_logging_level.assert_called_with(1)
Пример #11
0
def test__dispatch_unknown_command():
    dispatch._dispatch(['unknown_command'])
Пример #12
0
def test__dispatch_quiet(set_logging_level):
    assert dispatch._dispatch(['-q']) == 0
    set_logging_level.assert_called_with(0)
Пример #13
0
def test__dispatch_version():
    assert dispatch._dispatch(['--version']) == 0
Пример #14
0
def test__dispatch_verbose(set_logging_level):
    assert dispatch._dispatch(['-v']) == 0
    set_logging_level.assert_called_with(1)
Пример #15
0
def test__dispatch_help():
    assert dispatch._dispatch(['-h']) == 0
Пример #16
0
def test__dispatch_debug(set_logging_level):
    assert dispatch._dispatch(['-d']) == 0
    set_logging_level.assert_called_with(1)