Example #1
0
 def test_dump(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     with patch.dict(data.__opts__, {'cachedir': '/'}):
         with patch('salt.utils.files.fopen', mock_open()):
             self.assertTrue(data.dump('{"eggs": "spam"}'))
Example #2
0
 def test_dump(self):
     """
     Test if it replace the entire datastore with a passed data structure
     """
     with patch.dict(data.__opts__, {"cachedir": "/"}):
         with patch("salt.utils.files.fopen", mock_open()):
             self.assertTrue(data.dump('{"eggs": "spam"}'))
Example #3
0
 def test_dump_ioerror(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     with patch.dict(data.__opts__, {'cachedir': '/'}):
         mock = MagicMock(side_effect=IOError(''))
         with patch('salt.utils.files.fopen', mock):
             self.assertFalse(data.dump('{"eggs": "spam"}'))
Example #4
0
 def test_dump_ioerror(self):
     """
     Test if it replace the entire datastore with a passed data structure
     """
     with patch.dict(data.__opts__, {"cachedir": "/"}):
         mock = MagicMock(side_effect=IOError(""))
         with patch("salt.utils.files.fopen", mock):
             self.assertFalse(data.dump('{"eggs": "spam"}'))
Example #5
0
 def test_dump(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     mock = MagicMock(return_value='/')
     with patch.dict(data.__opts__, {'cachedir': mock}):
         with patch('salt.utils.fopen', mock_open()):
             self.assertTrue(data.dump('{"eggs": "spam"}'))
Example #6
0
 def test_dump_ioerror(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     mock = MagicMock(return_value='/')
     with patch.dict(data.__opts__, {'cachedir': mock}):
         mock = MagicMock(side_effect=IOError(''))
         with patch('salt.utils.fopen', mock):
             self.assertFalse(data.dump('{"eggs": "spam"}'))
Example #7
0
 def test_dump_isinstance(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     with patch('ast.literal_eval', MagicMock(return_value='')):
         self.assertFalse(data.dump('salt'))
Example #8
0
 def test_dump_isinstance(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     self.assertFalse(data.dump('salt'))
Example #9
0
 def test_dump_isinstance(self):
     """
     Test if it replace the entire datastore with a passed data structure
     """
     with patch("ast.literal_eval", MagicMock(return_value="")):
         self.assertFalse(data.dump("salt"))
Example #10
0
 def test_dump_isinstance(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     self.assertFalse(data.dump('salt'))