예제 #1
0
    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, {})
예제 #2
0
  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, {})
예제 #3
0
  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, {})
예제 #4
0
  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, {})
예제 #5
0
  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, {})
예제 #6
0
    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, {})
예제 #7
0
    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, {})
예제 #8
0
    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, {})