def test_freemem(self): ''' Test to return an int representing the amount of memory that has not been given to virtual machines on this node ''' mock = MagicMock(return_value={'free_memory': 1024}) with patch.object(xapi, "node_info", mock): self.assertEqual(xapi.freemem(), 1024)