mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
8cdb9ea54f
This makes the 2.x usage invalid syntax and forces the use of print as a function. This adds the import to the files which I've updated in the last couple of days but forgot to add it.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
# coding: utf-8
|
|
|
|
# Import python libs
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
# Import Salt Testing libs
|
|
from tests.support.unit import TestCase
|
|
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
|
|
|
|
# Import Salt libs
|
|
import salt.wheel
|
|
|
|
|
|
class KeyWheelModuleTest(TestCase, AdaptedConfigurationTestCaseMixin):
|
|
def setUp(self):
|
|
self.wheel = salt.wheel.Wheel(dict(self.get_config('client_config')))
|
|
|
|
def tearDown(self):
|
|
del self.wheel
|
|
|
|
def test_list_all(self):
|
|
ret = self.wheel.cmd('key.list_all', print_event=False)
|
|
for host in ['minion', 'sub_minion']:
|
|
self.assertIn(host, ret['minions'])
|
|
|
|
def test_gen(self):
|
|
ret = self.wheel.cmd('key.gen', kwarg={'id_': 'soundtechniciansrock'}, print_event=False)
|
|
|
|
self.assertIn('pub', ret)
|
|
self.assertIn('priv', ret)
|
|
try:
|
|
self.assertTrue(
|
|
ret.get('pub', '').startswith('-----BEGIN PUBLIC KEY-----'))
|
|
except AssertionError:
|
|
self.assertTrue(
|
|
ret.get('pub', '').startswith('-----BEGIN RSA PUBLIC KEY-----'))
|
|
|
|
self.assertTrue(
|
|
ret.get('priv', '').startswith('-----BEGIN RSA PRIVATE KEY-----'))
|