# coding: utf-8

# Import Salt Testing libs
from __future__ import absolute_import
import integration

# Import Salt libs
import salt.wheel


class KeyWheelModuleTest(integration.TestCase, integration.AdaptedConfigurationTestCaseMixIn):
    def setUp(self):
        self.wheel = salt.wheel.Wheel(dict(self.get_config('client_config')))

    def test_list_all(self):
        ret = self.wheel.call_func('key.list_all')
        self.assertEqual(ret, {
            'local': [
                'master.pem',
                'master.pub',
                'minion.pem',
                'minion.pub',
                'minion_master.pub',
                'syndic_master.pub'
            ],
            'minions_rejected': [],
            'minions_pre': [],
            'minions_denied': [],
            'minions': ['minion', 'sub_minion'],
        })

    def test_gen(self):
        ret = self.wheel.call_func('key.gen', id_='soundtechniciansrock')

        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)

@@ -422,422 +422,92 @@
     
-self.assertEqual(ret, %7B%0A            'local': %5B%0A                'master.pem',%0A                'master.pub',%0A                'minion.pem',%0A                'minion.pub',%0A                'minion_master.pub',%0A                'syndic_master.pub'%0A            %5D,%0A            'minions_rejected': %5B%5D,%0A            'minions_pre': %5B%5D,%0A            'minions_denied': %5B%5D,%0A            'minions': %5B'minion', 'sub_minion'%5D,%0A        %7D
+for host in %5B'minion', 'sub_minion'%5D:%0A            self.assertIn(host, ret%5B'minions'%5D
 )%0A%0A 

Fix wheel test