Esempio n. 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"}'))
Esempio n. 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"}'))
Esempio n. 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"}'))
Esempio n. 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"}'))
Esempio n. 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"}'))
Esempio n. 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"}'))
Esempio n. 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'))
Esempio n. 8
0
 def test_dump_isinstance(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     self.assertFalse(data.dump('salt'))
Esempio n. 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"))
Esempio n. 10
0
 def test_dump_isinstance(self):
     '''
     Test if it replace the entire datastore with a passed data structure
     '''
     self.assertFalse(data.dump('salt'))