コード例 #1
0
ファイル: test_bind.py プロジェクト: asmacdo/pulp_rpm
    def test_handle_not_found_default(self, mock_super_not_found):
        """
        Test that for all other cases, the parent class handler is called
        """
        # Setup
        exception = NotFoundException({})
        handler = UnbindExceptionHandler(mock.Mock(), mock.Mock())

        result = handler.handle_not_found(exception)
        self.assertEquals(result, CODE_NOT_FOUND)
        mock_super_not_found.assert_called_once_with(handler, exception)
コード例 #2
0
ファイル: test_bind.py プロジェクト: ulif/pulp_rpm
    def test_handle_not_found_default(self, mock_super_not_found):
        """
        Test that for all other cases, the parent class handler is called
        """
        # Setup
        exception = NotFoundException({})
        handler = UnbindExceptionHandler(mock.Mock(), mock.Mock())

        result = handler.handle_not_found(exception)
        self.assertEquals(result, CODE_NOT_FOUND)
        mock_super_not_found.assert_called_once_with(handler, exception)
コード例 #3
0
ファイル: test_bind.py プロジェクト: asmacdo/pulp_rpm
    def test_handle_not_found_bind_id(self):
        """
        Test that when the bind_id is returned, a user-friendly message is printed
        """
        # Setup
        exception = NotFoundException({'resources': {'bind_id': 'much unfriendly'}})
        mock_prompt = mock.Mock()
        handler = UnbindExceptionHandler(mock_prompt, mock.Mock())

        result = handler.handle_not_found(exception)
        self.assertEquals(result, CODE_NOT_FOUND)
        mock_prompt.render_failure_message.assert_called_once_with(_('The binding could not be found.'))
コード例 #4
0
ファイル: test_bind.py プロジェクト: ulif/pulp_rpm
    def test_handle_not_found_bind_id(self):
        """
        Test that when the bind_id is returned, a user-friendly message is printed
        """
        # Setup
        exception = NotFoundException(
            {'resources': {
                'bind_id': 'much unfriendly'
            }})
        mock_prompt = mock.Mock()
        handler = UnbindExceptionHandler(mock_prompt, mock.Mock())

        result = handler.handle_not_found(exception)
        self.assertEquals(result, CODE_NOT_FOUND)
        mock_prompt.render_failure_message.assert_called_once_with(
            _('The binding could not be found.'))