2013-12-13 22:26:33 +00:00
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
# Import Salt Testing libs
|
2014-11-21 19:05:13 +00:00
|
|
|
from __future__ import absolute_import
|
2013-12-13 22:26:33 +00:00
|
|
|
import integration
|
|
|
|
|
|
|
|
# Import Salt libs
|
|
|
|
import salt.wheel
|
|
|
|
|
2013-12-13 23:32:08 +00:00
|
|
|
|
2014-10-07 11:22:20 +00:00
|
|
|
class KeyWheelModuleTest(integration.TestCase, integration.AdaptedConfigurationTestCaseMixIn):
|
2013-12-13 22:26:33 +00:00
|
|
|
def setUp(self):
|
2015-01-27 21:11:01 +00:00
|
|
|
self.wheel = salt.wheel.Wheel(dict(self.get_config('client_config')))
|
2013-12-13 22:26:33 +00:00
|
|
|
|
|
|
|
def test_list_all(self):
|
2016-08-22 04:11:38 +00:00
|
|
|
ret = self.wheel.cmd('key.list_all', print_event=False)
|
2016-07-21 19:54:32 +00:00
|
|
|
for host in ['minion', 'sub_minion']:
|
|
|
|
self.assertIn(host, ret['minions'])
|
2013-12-13 22:26:33 +00:00
|
|
|
|
|
|
|
def test_gen(self):
|
2016-08-22 04:31:23 +00:00
|
|
|
ret = self.wheel.cmd('key.gen', kwarg={'id_': 'soundtechniciansrock'}, print_event=False)
|
2013-12-13 22:26:33 +00:00
|
|
|
|
|
|
|
self.assertIn('pub', ret)
|
|
|
|
self.assertIn('priv', ret)
|
|
|
|
self.assertTrue(
|
|
|
|
ret.get('pub', '').startswith('-----BEGIN PUBLIC KEY-----'))
|
|
|
|
self.assertTrue(
|
|
|
|
ret.get('priv', '').startswith('-----BEGIN RSA PRIVATE KEY-----'))
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(KeyWheelModuleTest, needs_daemon=True)
|