salt/tests/integration/client/runner.py
Colton Myers c4f5e231fa Merge remote-tracking branch 'upstream/2015.5' into merge-forward-develop2
Conflicts:
    doc/_themes/saltstack2/layout.html
    doc/conf.py
    doc/index.rst
    doc/ref/modules/all/salt.modules.hipchat.rst
    doc/topics/releases/index.rst
    salt/client/ssh/client.py
    salt/cloud/clouds/vsphere.py
    salt/modules/boto_dynamodb.py
    salt/modules/boto_route53.py
    salt/modules/data.py
    salt/modules/http.py
    salt/modules/tls.py
    salt/output/compact.py
    salt/states/boto_elb.py
    salt/states/linux_acl.py
    salt/states/rabbitmq_user.py
    salt/states/win_servermanager.py
    salt/utils/dictupdate.py
    salt/wheel/config.py
2015-05-29 15:10:13 -06:00

108 lines
2.8 KiB
Python

# coding: utf-8
# Import python libs
from __future__ import absolute_import
# Import Salt Testing libs
import integration
from salttesting import skipIf
# Import Salt libs
import salt.runner
class RunnerModuleTest(integration.TestCase, integration.AdaptedConfigurationTestCaseMixIn):
eauth_creds = {
'username': 'saltdev_auto',
'password': 'saltdev',
'eauth': 'auto',
}
def setUp(self):
'''
Configure an eauth user to test with
'''
self.runner = salt.runner.RunnerClient(self.get_config('client_config'))
def test_eauth(self):
'''
Test executing master_call with lowdata
The choice of using error.error for this is arbitrary and should be
changed to some mocked function that is more testing friendly.
'''
low = {
'client': 'runner',
'fun': 'error.error',
}
low.update(self.eauth_creds)
self.runner.master_call(**low)
def test_token(self):
'''
Test executing master_call with lowdata
The choice of using error.error for this is arbitrary and should be
changed to some mocked function that is more testing friendly.
'''
import salt.auth
auth = salt.auth.LoadAuth(self.get_config('client_config'))
token = auth.mk_token(self.eauth_creds)
self.runner.master_call(**{
'client': 'runner',
'fun': 'error.error',
'token': token['token'],
})
@skipIf(True, 'to be reenabled when #23623 is merged')
def test_cmd_sync(self):
low = {
'client': 'runner',
'fun': 'error.error',
}
low.update(self.eauth_creds)
self.runner.cmd_sync(low)
def test_cmd_async(self):
low = {
'client': 'runner',
'fun': 'error.error',
}
low.update(self.eauth_creds)
self.runner.cmd_async(low)
@skipIf(True, 'to be reenabled when #23623 is merged')
def test_cmd_sync_w_arg(self):
low = {
'fun': 'test.arg',
'foo': 'Foo!',
'bar': 'Bar!',
}
low.update(self.eauth_creds)
ret = self.runner.cmd_sync(low)
self.assertEqual(ret['kwargs']['foo'], 'Foo!')
self.assertEqual(ret['kwargs']['bar'], 'Bar!')
@skipIf(True, 'to be reenabled when #23623 is merged')
def test_wildcard_auth(self):
low = {
'username': 'the_s0und_of_t3ch',
'password': 'willrockyou',
'eauth': 'auto',
'fun': 'test.arg',
'foo': 'Foo!',
'bar': 'Bar!',
}
self.runner.cmd_sync(low)
if __name__ == '__main__':
from integration import run_tests
run_tests(RunnerModuleTest, needs_daemon=True)