Search in sources :

Example 51 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyAccessibleForInstructorsOfTheSameCourse.

protected void verifyAccessibleForInstructorsOfTheSameCourse(String[] submissionParams) {
    ______TS("course instructor can access");
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1");
    InstructorAttributes otherInstructor = typicalBundle.instructors.get("instructor1OfCourse2");
    gaeSimulation.loginAsInstructor(instructor1OfCourse1.googleId);
    verifyCanAccess(submissionParams);
    verifyCannotMasquerade(addUserIdToParams(student1InCourse1.googleId, submissionParams));
    verifyCannotMasquerade(addUserIdToParams(otherInstructor.googleId, submissionParams));
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 52 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyUnaccessibleForUnregisteredUsers.

protected void verifyUnaccessibleForUnregisteredUsers(String[] submissionParams) {
    ______TS("non-registered users cannot access");
    String unregUserId = "unreg.user";
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1");
    gaeSimulation.loginUser(unregUserId);
    verifyCannotAccess(submissionParams);
    verifyCannotMasquerade(addUserIdToParams(student1InCourse1.googleId, submissionParams));
    verifyCannotMasquerade(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams));
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 53 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyUnaccessibleWithoutModifySessionCommentInSectionsPrivilege.

protected void verifyUnaccessibleWithoutModifySessionCommentInSectionsPrivilege(String[] submissionParams) {
    ______TS("without Modify-Session-Comment-In-Sections privilege cannot access");
    InstructorAttributes helperOfCourse1 = typicalBundle.instructors.get("helperOfCourse1");
    gaeSimulation.loginAsInstructor(helperOfCourse1.googleId);
    verifyCannotAccess(submissionParams);
}
Also used : InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 54 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyUnaccessibleWithoutModifyStudentPrivilege.

protected void verifyUnaccessibleWithoutModifyStudentPrivilege(String[] submissionParams) {
    ______TS("without Modify-Student privilege cannot access");
    InstructorAttributes helperOfCourse1 = typicalBundle.instructors.get("helperOfCourse1");
    gaeSimulation.loginAsInstructor(helperOfCourse1.googleId);
    verifyCannotAccess(submissionParams);
}
Also used : InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 55 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes 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

InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)325 Test (org.testng.annotations.Test)127 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)84 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)77 ArrayList (java.util.ArrayList)58 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)47 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)46 RedirectResult (teammates.ui.controller.RedirectResult)46 StatusMessage (teammates.common.util.StatusMessage)34 ShowPageResult (teammates.ui.controller.ShowPageResult)31 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)30 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)29 HashMap (java.util.HashMap)25 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)24 InvalidParametersException (teammates.common.exception.InvalidParametersException)24 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)20 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)18 EmailWrapper (teammates.common.util.EmailWrapper)15 InstructorPrivileges (teammates.common.datatransfer.InstructorPrivileges)14 DataBundle (teammates.common.datatransfer.DataBundle)13