Esempio n. 1
0
def mock_hub() -> testing.MockHub:
    '''
    mock the needed subs for the heist tests
    '''
    # A fixture is required for asynchronous tests to access a mock_hub
    return helpers.mock_hub(
        subs=['heist.heist', 'roster', 'tunnel', 'artifact'])
Esempio n. 2
0
 def test__get_asyncssh_opt_autodetect(self, mocked_autodetect):
     '''
     Test getting option from autodetect of target and config aren't available
     '''
     mock_hub = helpers.mock_hub()
     mock_hub.OPT = {'heis': {}}
     target = {}
     result = asyncssh_tunnel._get_asyncssh_opt(mock_hub,
                                                target=target,
                                                option='username',
                                                default='default')
     assert result == 'autodetect'
Esempio n. 3
0
 def test__get_asyncssh_opt_target(self):
     '''
     Test getting option from the target
     '''
     mock_hub = helpers.mock_hub()
     mock_hub.OPT = {'heis': {'username', 'opt'}}
     target = {'username': '******'}
     result = asyncssh_tunnel._get_asyncssh_opt(mock_hub,
                                                target=target,
                                                option='username',
                                                default='default')
     assert result == 'target'
Esempio n. 4
0
 def test__get_asyncssh_opt_config(self):
     '''
     Test getting option from the config if target isn't available
     '''
     mock_hub = helpers.mock_hub()
     mock_hub.OPT = {'heis': {'username': '******'}}
     target = {}
     result = asyncssh_tunnel._get_asyncssh_opt(mock_hub,
                                                target=target,
                                                option='username',
                                                default='default')
     assert result == 'opt'
Esempio n. 5
0
 def test_start(self):
     mock_hub = helpers.mock_hub(['heis.heis'])
     heis.heis.init.start(mock_hub)
     mock_hub.pop.loop.start.assert_called_once()
     mock_hub.heis.init.run.assert_called_once()
Esempio n. 6
0
 def test_load_subs(self):
     mock_hub = helpers.mock_hub()
     heis.heis.init.load_subs(mock_hub)
     mock_hub.pop.sub.add.assert_any_call(dyne_name='rend')
     mock_hub.pop.sub.add.assert_any_call(dyne_name='roster')
     mock_hub.pop.sub.add.assert_any_call(dyne_name='tunnel')
Esempio n. 7
0
def mock_hub() -> testing.MockHub:
    # A fixture is required for asynchronous tests to access a mock_hub
    return helpers.mock_hub(subs=['heis.heis', 'heis.roster'])
Esempio n. 8
0
def mock_hub():
    # A fixture is required for asynchronous tests to access a mock_hub
    return helpers.mock_hub(
        subs=['heis.heis', 'heis.roster', 'rend', 'output'])
Esempio n. 9
0
def mock_hub():
    '''
    mock the needed subs for the flat roster tests
    '''
    # A fixture is required for asynchronous tests to access a mock_hub
    return helpers.mock_hub(subs=['heist.heist', 'heist.roster', 'rend', 'output'])