예제 #1
0
 def test_updated_return_when_cache_file_does_not_exist(self):
     '''
     Tests that the updated function returns None when the cache key file doesn't
     exist.
     '''
     with patch('os.path.isfile', MagicMock(return_value=False)):
         self.assertIsNone(localfs.updated(bank='', key='', cachedir=''))
예제 #2
0
 def test_updated_return_when_cache_file_does_not_exist(self):
     """
     Tests that the updated function returns None when the cache key file doesn't
     exist.
     """
     with patch("os.path.isfile", MagicMock(return_value=False)):
         self.assertIsNone(localfs.updated(bank="", key="", cachedir=""))
예제 #3
0
파일: localfs_test.py 프로젝트: bryson/salt
    def test_updated_success(self):
        """
        Test that the updated function returns the modification time of the cache file
        """
        # Create a temporary cache dir
        tmp_dir = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR)

        # Use the helper function to create the cache file using localfs.store()
        self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self))

        with patch("os.path.join", MagicMock(return_value=tmp_dir + "/bank/key.p")):
            self.assertIsInstance(localfs.updated(bank="bank", key="key"), int)
예제 #4
0
    def test_updated_success(self):
        '''
        Test that the updated function returns the modification time of the cache file
        '''
        # Create a temporary cache dir
        tmp_dir = tempfile.mkdtemp(dir=TMP)

        # Use the helper function to create the cache file using localfs.store()
        self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self))

        with patch('os.path.join', MagicMock(return_value=tmp_dir + '/bank/key.p')):
            self.assertIsInstance(localfs.updated(bank='bank', key='key', cachedir=tmp_dir), int)
예제 #5
0
    def test_updated_success(self):
        """
        Test that the updated function returns the modification time of the cache file
        """
        # Create a temporary cache dir
        tmp_dir = tempfile.mkdtemp(dir=RUNTIME_VARS.TMP)

        # Use the helper function to create the cache file using localfs.store()
        self._create_tmp_cache_file(tmp_dir, salt.payload.Serial(self))

        with patch("os.path.join", MagicMock(return_value=tmp_dir + "/bank/key.p")):
            self.assertIsInstance(
                localfs.updated(bank="bank", key="key", cachedir=tmp_dir), int
            )
예제 #6
0
 def test_updated_return_when_cache_file_does_not_exist(self):
     '''
     Tests that the updated function returns None when the cache key file doesn't
     exist.
     '''
     self.assertIsNone(localfs.updated(bank='', key='', cachedir=''))
예제 #7
0
파일: localfs_test.py 프로젝트: bryson/salt
 def test_updated_return_when_cache_file_does_not_exist(self):
     """
     Tests that the updated function returns None when the cache key file doesn't
     exist.
     """
     self.assertIsNone(localfs.updated(bank="", key=""))