def testunit_main_WHEN_request_RAISES_other_exception(self, mock_exit,
                                                          mock_handle_request):
        mock_handle_request.side_effect = Exception('fake eof')

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(1)
    def testunit_main_WHEN_request_RAISES_ioerror(self, mock_exit,
                                                  mock_handle_request):
        mock_handle_request.side_effect = IOError(-1, 'fake ioerror')

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(1)
    def testunit_main_WHEN_request_RAISES_other_exception(self, mock_exit,
                                                          mock_handle_request):
        mock_handle_request.side_effect = Exception('fake eof')

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(1)
    def testunit_main_WHEN_request_RAISES_ioerror(self, mock_exit,
                                                  mock_handle_request):
        mock_handle_request.side_effect = IOError(-1, 'fake ioerror')

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(1)
    def testunit_main_WHEN_request_RAISES_eof(self, mock_exit,
                                              mock_handle_request):
        mock_handle_request.side_effect = (
            vs_resource_backend.EndOfFileError('fake eof'))

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(0)
    def testunit_main_WHEN_request_RAISES_eof(self, mock_exit,
                                              mock_handle_request):
        mock_handle_request.side_effect = (
            vs_resource_backend.EndOfFileError('fake eof'))

        vs_resource_backend.main()

        self.assertTrue(mock_handle_request.called)
        mock_exit.assert_called_with(0)