Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 5
0
def test__dispatch_unknown_command():
    dispatch._dispatch(['unknown_command'])
Ejemplo n.º 6
0
def test__dispatch_quiet(set_logging_level):
    assert dispatch._dispatch(['-q']) == 0
    set_logging_level.assert_called_with(0)
Ejemplo n.º 7
0
def test__dispatch_version():
    assert dispatch._dispatch(['--version']) == 0
Ejemplo n.º 8
0
def test__dispatch_verbose(set_logging_level):
    assert dispatch._dispatch(['-v']) == 0
    set_logging_level.assert_called_with(1)
Ejemplo n.º 9
0
def test__dispatch_help():
    assert dispatch._dispatch(['-h']) == 0
Ejemplo n.º 10
0
def test__dispatch_debug(set_logging_level):
    assert dispatch._dispatch(['-d']) == 0
    set_logging_level.assert_called_with(1)
Ejemplo n.º 11
0
def test__dispatch_unknown_command():
    dispatch._dispatch(['unknown_command'])
Ejemplo n.º 12
0
def test__dispatch_quiet(set_logging_level):
    assert dispatch._dispatch(['-q']) == 0
    set_logging_level.assert_called_with(0)
Ejemplo n.º 13
0
def test__dispatch_version():
    assert dispatch._dispatch(['--version']) == 0
Ejemplo n.º 14
0
def test__dispatch_verbose(set_logging_level):
    assert dispatch._dispatch(['-v']) == 0
    set_logging_level.assert_called_with(1)
Ejemplo n.º 15
0
def test__dispatch_help():
    assert dispatch._dispatch(['-h']) == 0
Ejemplo n.º 16
0
def test__dispatch_debug(set_logging_level):
    assert dispatch._dispatch(['-d']) == 0
    set_logging_level.assert_called_with(1)