def testunit_get_xid_dlimits(self, mock_vc_get_dlimit): vs_resource_backend._VS_PREFIX_DIR = self._testdata_dir dlim = [0, 1, 2, 3, 4] mock_vc_get_dlimit.return_value = dlim expected_value = {'515': list(dlim)} returned_value = vs_resource_backend.get_xid_dlimits() self.assertEqual(expected_value, returned_value)
def testunit_get_xid_dlimits_WHEN_vc_get_dlimit_RAISES_Exception( self, mock_vc_get_dlimit): vs_resource_backend._VS_PREFIX_DIR = self._testdata_dir mock_vc_get_dlimit.side_effect = ( vs_resource_backend.LibVserverError('broken system call')) expected_value = {} returned_value = vs_resource_backend.get_xid_dlimits() self.assertDictEqual(expected_value, returned_value)