← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/answers-api-4 into lp:launchpad

 

The proposal to merge lp:~sinzui/launchpad/answers-api-4 into lp:launchpad has been updated.

Description changed to:

Consolidate and export question errors.

    Launchpad bug: https://bugs.launchpad.net/bugs/786297
    Pre-implementation: no one

Consolidate answers errors and export all question model errors to the
webservice.

--------------------------------------------------------------------

RULES

    * Move InvalidQuestionStateError and other errors to errors.py
      and export them.
    * Replace all asserts with errors.
    * Export all errors

QA

    This cannot be QAed since The browser view do not let users create
    oopses, and the methods that could raise the errors are not exported.

LINT

    lib/lp/answers/errors.py
    lib/lp/answers/doc/faq.txt
    lib/lp/answers/doc/workflow.txt
    lib/lp/answers/interfaces/question.py
    lib/lp/answers/interfaces/questiontarget.py
    lib/lp/answers/model/question.py
    lib/lp/answers/tests/test_question_webservice.py
    lib/lp/answers/tests/test_question_workflow.py
    lib/lp/testing/views.py

TEST

    ./bin/test -vv -t ErrorsTestCase -m lp.answers

IMPLEMENTATION

Moved InvalidQuestionStateError to the errors module. I revise the doc string
because the error does not mean the question *is* in an invalid state, but
that it *would* be in an invalid state.
    lib/lp/answers/errors.py
    lib/lp/answers/interfaces/question.py

Replaced assertions in model/question.py with specific errors defined in the
errors module. Updated existing tests.
    lib/lp/answers/errors.py
    lib/lp/answers/doc/faq.txt
    lib/lp/answers/doc/workflow.txt
    lib/lp/answers/interfaces/questiontarget.py
    lib/lp/answers/model/question.py
    lib/lp/answers/tests/test_question_workflow.py

Added a helper to test that errors are exported. Tests do not need to
duplicate model tests and hope that some lazr.restful magic happens.
Webservice error are simple adaptions, just like browser errors.
    lib/lp/testing/views.py

Exported the new errors.
    lib/lp/answers/errors.py
    lib/lp/answers/tests/test_question_webservice.py

For more details, see:
https://code.launchpad.net/~sinzui/launchpad/answers-api-4/+merge/61872
-- 
https://code.launchpad.net/~sinzui/launchpad/answers-api-4/+merge/61872
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/answers-api-4 into lp:launchpad.


References