Search in sources :

Example 1 with ErrorUserReportLogAction

use of teammates.ui.controller.ErrorUserReportLogAction in project teammates by TEAMMATES.

the class ErrorUserReportLogActionTest method testExecuteAndPostProcess.

@Override
@Test
protected void testExecuteAndPostProcess() throws Exception {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Typical Success Case");
    final String testErrorReportSubject = "Test Error Subject";
    final String testErrorReportContent = "This is a test user-submitted error report.";
    final String testErrorReportRequestedUrl = "/page/testurl";
    String[] params = new String[] { Const.ParamsNames.ERROR_FEEDBACK_URL_REQUESTED, testErrorReportRequestedUrl, Const.ParamsNames.ERROR_FEEDBACK_EMAIL_SUBJECT, testErrorReportSubject, Const.ParamsNames.ERROR_FEEDBACK_EMAIL_CONTENT, testErrorReportContent };
    ErrorUserReportLogAction action = getAction(params);
    AjaxResult result = getAjaxResult(action);
    assertEquals(Const.StatusMessages.ERROR_FEEDBACK_SUBMIT_SUCCESS, result.getStatusMessage());
    // getting basic AccountAttributes because ErrorUserReportLogAction only logs this.
    AccountAttributes instructor1ofCourse1AccountAttributes = accountsLogic.getAccount(instructor1ofCourse1.googleId, false);
    final String expectedLogMessage = "====== USER FEEDBACK ABOUT ERROR ====== \n" + "REQUESTED URL: " + testErrorReportRequestedUrl + "\n" + "ACCOUNT DETAILS: " + instructor1ofCourse1AccountAttributes.toString() + "\n" + "SUBJECT: " + testErrorReportSubject + "\n" + "FEEDBACK: " + testErrorReportContent;
    assertEquals(expectedLogMessage, action.getUserErrorReportLogMessage());
}
Also used : AjaxResult(teammates.ui.controller.AjaxResult) ErrorUserReportLogAction(teammates.ui.controller.ErrorUserReportLogAction) AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 AjaxResult (teammates.ui.controller.AjaxResult)1 ErrorUserReportLogAction (teammates.ui.controller.ErrorUserReportLogAction)1