Part of lp.answers.tests.test_question_workflow View In Hierarchy
Known subclasses: lp.answers.tests.test_question_workflow.ConfirmAnswerTestCase, lp.answers.tests.test_question_workflow.ExpireQuestionTestCase, lp.answers.tests.test_question_workflow.GiveAnswerTestCase, lp.answers.tests.test_question_workflow.GiveInfoTestCase, lp.answers.tests.test_question_workflow.LinkFAQTestCase, lp.answers.tests.test_question_workflow.MiscAnswerTrackerWorkflowTestCase, lp.answers.tests.test_question_workflow.RejectTestCase, lp.answers.tests.test_question_workflow.ReopenTestCase, lp.answers.tests.test_question_workflow.RequestInfoTestCase
It provides the common fixture and test helper methods.
Method | setUp | Undocumented |
Method | tearDown | Undocumented |
Method | setQuestionStatus | Utility metho to change a question status. |
Method | setUpEventListeners | Install a listener for events emitted during the test. |
Method | collectEvent | Collect events |
Method | nowPlus | Return a DateTime a number of hours in the future. |
Method | checkTransitionMessage | Helper method to check the message created by a transition. |
Method | checkTransitionEvents | Helper method to validate the events triggered from the transition. |
Method | _testTransitionGuard | Helper for transition guard tests. |
Method | _testValidTransition | Helper for testing valid state transitions. |
Method | _testInvalidTransition | Helper for testing invalid transitions. |
This logs in as admin, change the status and log back as the previous user.
Helper that verifies that the Question guard_name attribute is True when the question status is one listed in statuses_expected_true and False otherwise.
Helper that verifies that transition_method can be called when the question status is one listed in statuses. It will validate the returned message using checkTransitionMessage(). The transition_method is called with the transition_method_args as positional parameters and transition_method_kwargs as keyword parameters.
If extra_message_check is passed a function, it will be called with the returned message for extra checks.
The datecreated parameter to the transition_method is set automatically to a value that will make the message sort last.
The edited_fields parameter contain the list of field that are expected to be present in IObjectModifiedEvent that should be triggered.
Helper that verifies that transition_method method cannot be called when the question status is different than the ones in valid_statuses.
args and kwargs contains the parameters that should be passed to the transition method.
It make sure that the message provides IQuestionMessage and that it was appended to the question messages attribute. It also checks that the subject was computed correctly and that the new_status, action and owner attributes were set correctly.
It also verifies that the question status, datelastquery (or datelastresponse) were updated to reflect the time of the message.
Check that an IObjectCreatedEvent event was sent when the message was created and that an IObjectModifiedEvent was also sent. The event object and edited_fields attribute are checked.