def test_vagrant_get_vm_info_not_found(self): mock_sdb = MagicMock(return_value=None) with patch.dict(vagrant.__utils__, {'sdb.sdb_get': mock_sdb}): with self.assertRaises(salt.exceptions.SaltInvocationError): vagrant.get_vm_info('thisNameDoesNotExist')
def test_vagrant_get_vm_info(self): testdict = {'testone': 'one', 'machine': 'two'} mock_sdb = MagicMock(return_value=testdict) with patch.dict(vagrant.__utils__, {'sdb.sdb_get': mock_sdb}): resp = vagrant.get_vm_info('test1') self.assertEqual(resp, testdict)
def test_vagrant_get_vm_info(self): testdict = {"testone": "one", "machine": "two"} mock_sdb = MagicMock(return_value=testdict) with patch.dict(vagrant.__utils__, {"sdb.sdb_get": mock_sdb}): resp = vagrant.get_vm_info("test1") self.assertEqual(resp, testdict)