'''
Tests for the file state
'''
# Import python libs
import os
#
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon


class CMDTest(integration.ModuleCase):
    '''
    Validate the cmd state
    '''
    def test_run(self):
        '''
        cmd.run
        '''
        ret = self.run_state('cmd.run', name='ls', cwd='/')
        result = ret[next(iter(ret))]['result']
        self.assertTrue(result)

    def test_test_run(self):
        '''
        cmd.run test interface
        '''
        ret = self.run_state('cmd.run', name='ls', test=True)
        result = ret[next(iter(ret))]['result']
        self.assertIsNone(result)

'''
Tests for the file state
'''
# Import python libs

# Import salt libs
import integration
import tempfile


class CMDTest(integration.ModuleCase):
    '''
    Validate the cmd state
    '''
    def test_run(self):
        '''
        cmd.run
        '''

        ret = self.run_state('cmd.run', name='ls', cwd=tempfile.gettempdir())
        result = ret[next(iter(ret))]['result']
        self.assertTrue(result)

    def test_test_run(self):
        '''
        cmd.run test interface
        '''
        ret = self.run_state('cmd.run', name='ls',
                             cwd=tempfile.gettempdir(), test=True)
        result = ret[next(iter(ret))]['result']
        self.assertIsNone(result)

Use tempdir to ensure there will always be a directory which can be accessed.
Use tempdir to ensure there will always be a directory which can be accessed.

  '''
  Tests for the file state
  '''
  # Import python libs
+ 
- import os
- #
  # Import salt libs
- from saltunittest import TestLoader, TextTestRunner
  import integration
- from integration import TestDaemon
+ import tempfile
  
  
  class CMDTest(integration.ModuleCase):
      '''
      Validate the cmd state
      '''
      def test_run(self):
          '''
          cmd.run
          '''
+ 
-         ret = self.run_state('cmd.run', name='ls', cwd='/')
+         ret = self.run_state('cmd.run', name='ls', cwd=tempfile.gettempdir())
          result = ret[next(iter(ret))]['result']
          self.assertTrue(result)
  
      def test_test_run(self):
          '''
          cmd.run test interface
          '''
-         ret = self.run_state('cmd.run', name='ls', test=True)
+         ret = self.run_state('cmd.run', name='ls',
+                              cwd=tempfile.gettempdir(), test=True)
          result = ret[next(iter(ret))]['result']
          self.assertIsNone(result)
  
Use tempdir to ensure there will always be a directory which can be accessed.
## Code Before:
'''
Tests for the file state
'''
# Import python libs
import os
#
# Import salt libs
from saltunittest import TestLoader, TextTestRunner
import integration
from integration import TestDaemon


class CMDTest(integration.ModuleCase):
    '''
    Validate the cmd state
    '''
    def test_run(self):
        '''
        cmd.run
        '''
        ret = self.run_state('cmd.run', name='ls', cwd='/')
        result = ret[next(iter(ret))]['result']
        self.assertTrue(result)

    def test_test_run(self):
        '''
        cmd.run test interface
        '''
        ret = self.run_state('cmd.run', name='ls', test=True)
        result = ret[next(iter(ret))]['result']
        self.assertIsNone(result)

## Instruction:
Use tempdir to ensure there will always be a directory which can be accessed.
## Code After:
'''
Tests for the file state
'''
# Import python libs

# Import salt libs
import integration
import tempfile


class CMDTest(integration.ModuleCase):
    '''
    Validate the cmd state
    '''
    def test_run(self):
        '''
        cmd.run
        '''

        ret = self.run_state('cmd.run', name='ls', cwd=tempfile.gettempdir())
        result = ret[next(iter(ret))]['result']
        self.assertTrue(result)

    def test_test_run(self):
        '''
        cmd.run test interface
        '''
        ret = self.run_state('cmd.run', name='ls',
                             cwd=tempfile.gettempdir(), test=True)
        result = ret[next(iter(ret))]['result']
        self.assertIsNone(result)
