@@ -0,0 +1,2502 @@
+# Import python libs%0Aimport os%0A%0A# Import salt libs%0Aimport integration%0A%0Aclass CMDModuleTest(integration.ModuleCase):%0A    '''%0A    Validate the cmd module%0A    '''%0A    def test_run(self):%0A        '''%0A        cmd.run%0A        '''%0A        self.assertTrue(self.run_function('cmd.run', %5B'echo $SHELL'%5D))%0A        self.assertEqual(%0A                self.run_function('cmd.run',%0A                    %5B'echo $SHELL', 'shell=/bin/bash'%5D),%0A                '/bin/bash')%0A%0A    def test_stdout(self):%0A        '''%0A        cmd.run_stdout%0A        '''%0A        self.assertEqual(%0A                self.run_function('cmd.run_stdout',%0A                    %5B'echo %22cheese%22'%5D),%0A                'cheese')%0A%0A    def test_stderr(self):%0A        '''%0A        cmd.run_stderr%0A        '''%0A        self.assertEqual(%0A                self.run_function('cmd.run_stderr',%0A                    %5B'echo %22cheese%22 1%3E&2'%5D),%0A                'cheese')%0A%0A    def test_run_all(self):%0A        '''%0A        cmd.run_all%0A        '''%0A        ret = self.run_function('cmd.run_all', %5B'echo %22cheese%22 1%3E&2'%5D)%0A        self.assertTrue('pid' in ret)%0A        self.assertTrue('retcode' in ret)%0A        self.assertTrue('stdout' in ret)%0A        self.assertTrue('stderr' in ret)%0A        self.assertTrue(isinstance(ret.get('pid'), int))%0A        self.assertTrue(isinstance(ret.get('retcode'), int))%0A        self.assertTrue(isinstance(ret.get('stdout'), basestring))%0A        self.assertTrue(isinstance(ret.get('stderr'), basestring))%0A        self.assertEqual(ret.get('stderr'), 'cheese')%0A%0A    def test_retcode(self):%0A        '''%0A        cmd.retcode%0A        '''%0A        self.assertEqual(self.run_function('cmd.retcode', %5B'true'%5D), 0)%0A        self.assertEqual(self.run_function('cmd.retcode', %5B'false'%5D), 1)%0A%0A    def test_which(self):%0A        '''%0A        cmd.which%0A        '''%0A        self.assertEqual(%0A                self.run_function('cmd.which', %5B'echo'%5D),%0A                self.run_function('cmd.run', %5B'which echo'%5D))%0A%0A    def test_has_exec(self):%0A        '''%0A        cmd.has_exec%0A        '''%0A        self.assertTrue(self.run_function('cmd.has_exec', %5B'python'%5D))%0A        self.assertFalse(self.run_function(%0A            'cmd.has_exec',%0A            %5B'alllfsdfnwieulrrh9123857ygf'%5D%0A            ))%0A%0A    def test_exec_code(self):%0A        '''%0A        cmd.exec_code%0A        '''%0A        code = '''%0Aimport sys%0Asys.stdout.write('cheese')%0A        '''%0A        self.assertEqual(%0A                self.run_function('cmd.exec_code', %5B'python', code%5D),%0A                'cheese'%0A                )%0A

Add tests for the cmd module