def testunit_read_vsys_data_direct_WHEN_sendrecv_RETURNS_bad_json(self): mock_vs = mock.Mock() mock_vs.sendrecv.return_value = '{"data": ' # an incomplete json reply. mlab._vs_vsys = mock_vs returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_sendrecv_RETURNS_empty_response(self): mock_vs = mock.Mock() mock_vs.sendrecv.return_value = '' mlab._vs_vsys = mock_vs returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_sendrecv_RAISES_VsysException(self): mock_vs = mock.Mock() mock_vs.sendrecv.side_effect = mlab.VsysException('fake exception') mlab._vs_vsys = mock_vs returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_VsysFrontend_RAISES_CreateException( self, mock_vsysfrontend): mlab._vs_vsys = None mock_vsysfrontend.side_effect = mlab.VsysCreateException('fake exception') returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_sendrecv_RETURNS_empty_response( self): mock_vs = mock.Mock() mock_vs.sendrecv.return_value = '' mlab._vs_vsys = mock_vs returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_sendrecv_RAISES_VsysException( self): mock_vs = mock.Mock() mock_vs.sendrecv.side_effect = mlab.VsysException('fake exception') mlab._vs_vsys = mock_vs returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})
def testunit_read_vsys_data_direct_WHEN_VsysFrontend_RAISES_CreateException( self, mock_vsysfrontend): mlab._vs_vsys = None mock_vsysfrontend.side_effect = mlab.VsysCreateException( 'fake exception') returned_value = mlab.read_vsys_data_direct('fake_request') self.assertDictEqual(returned_value, {})