Search in sources :

Example 81 with CourseAttributes

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

the class InstructorHomePageUiTest method testContent.

private void testContent() throws Exception {
    ______TS("content: no courses");
    // this case is implicitly tested when testing for 'delete course' action and
    // new instructor without sample course
    // loginAsInstructor(testData.accounts.get("newInstructorWithSampleCourse").email);
    ______TS("content: new instructor, with status message HINT_FOR_NEW_INSTRUCTOR");
    // already logged in
    homePage.loadInstructorHomeTab();
    homePage.verifyHtmlMainContent("/instructorHomeNewInstructorWithoutSampleCourse.html");
    CourseAttributes newCourse = CourseAttributes.builder("newIns.wit-demo", "Sample Course 101", ZoneId.of("UTC")).build();
    BackDoor.createCourse(newCourse);
    @SuppressWarnings("deprecation") InstructorAttributes instr = InstructorAttributes.builder("CHomeUiT.instructor.tmms.new", "newIns.wit-demo", "Teammates Test New Instructor With Sample", "CHomeUiT.instructor.tmms@gmail.tmt").build();
    BackDoor.createInstructor(instr);
    homePage.loadInstructorHomeTab();
    homePage.verifyHtmlMainContent("/instructorHomeNewInstructorWithSampleCourse.html");
    ______TS("content: multiple courses");
    loginAsCommonInstructor();
    // Should not see private session
    homePage.verifyHtmlMainContent("/instructorHomeHTMLWithHelperView.html");
    updateInstructorToCoownerPrivileges();
    homePage.loadInstructorHomeTab();
    homePage.verifyHtmlMainContent("/instructorHomeHTML.html");
    ______TS("content: require sanitization");
    loginAsInstructor("CHomeUiT.idOfInstructor1OfTestingSanitizationCourse");
    homePage.loadInstructorHomeTab();
    homePage.verifyHtmlMainContent("/instructorHomeTestingSanitization.html");
}
Also used : CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 82 with CourseAttributes

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

the class CourseAttributesTest method testBuilderWithNullCreatedAt.

@Test
public void testBuilderWithNullCreatedAt() {
    CourseAttributes courseAttributes = CourseAttributes.builder(validId, validName, validTimeZone).withCreatedAt(null).build();
    assertEquals(Instant.now(), courseAttributes.createdAt);
}
Also used : CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Example 83 with CourseAttributes

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

the class CourseAttributesTest method testValidate.

@Test
public void testValidate() throws Exception {
    CourseAttributes validCourse = generateValidCourseAttributesObject();
    assertTrue("valid value", validCourse.isValid());
    String veryLongId = StringHelperExtension.generateStringOfLength(FieldValidator.COURSE_ID_MAX_LENGTH + 1);
    String emptyName = "";
    CourseAttributes invalidCourse = CourseAttributes.builder(veryLongId, emptyName, validTimeZone).build();
    assertFalse("invalid value", invalidCourse.isValid());
    String errorMessage = getPopulatedErrorMessage(FieldValidator.COURSE_ID_ERROR_MESSAGE, invalidCourse.getId(), FieldValidator.COURSE_ID_FIELD_NAME, FieldValidator.REASON_TOO_LONG, FieldValidator.COURSE_ID_MAX_LENGTH) + System.lineSeparator() + getPopulatedEmptyStringErrorMessage(FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE_EMPTY_STRING, FieldValidator.COURSE_NAME_FIELD_NAME, FieldValidator.COURSE_NAME_MAX_LENGTH);
    assertEquals("invalid value", errorMessage, StringHelper.toString(invalidCourse.getInvalidityInfo()));
}
Also used : CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Example 84 with CourseAttributes

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

the class AdminSearchPageUiTest method testSearch.

private void testSearch() {
    ______TS("search for nothing");
    String searchContent = "";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    assertTrue(isPageTitleCorrect());
    assertTrue(isSearchPanelPresent());
    searchPage.waitForTextsForAllStatusMessagesToUserEquals("Search key cannot be empty");
    ______TS("search for student1");
    searchPage.clearSearchBox();
    searchContent = "student1";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    assertTrue(isSearchPanelPresent());
    assertTrue(isSearchDataDisplayCorrect());
    StudentAttributes student = testData.students.get("student1InCourse1");
    InstructorAttributes instructor = testData.instructors.get("instructor1OfCourse1");
    CourseAttributes course = testData.courses.get("typicalCourse1");
    assertStudentRowDisplayed(student, instructor, course);
    ______TS("search for student1 email");
    searchPage.clearSearchBox();
    searchContent = "searchUI.student1InCourse1@gmail.tmt";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    assertTrue(isSearchPanelPresent());
    assertTrue(isSearchDataDisplayCorrect());
    searchPage.waitForTextsForAllStatusMessagesToUserEquals("Total results found: 1");
    ______TS("search for student name with special characters");
    searchPage.clearSearchBox();
    searchContent = "student(1)";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    assertTrue(isSearchPanelPresent());
    assertTrue(isSearchDataDisplayCorrect());
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Example 85 with CourseAttributes

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

the class InstructorCourseStudentListDownloadActionTest method testAccessControl.

@Override
@Test
protected void testAccessControl() throws Exception {
    CourseAttributes course = typicalBundle.courses.get("typicalCourse1");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId() };
    verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
Also used : CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Aggregations

CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)106 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)48 Test (org.testng.annotations.Test)40 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)33 ArrayList (java.util.ArrayList)31 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)19 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)16 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)15 EmailWrapper (teammates.common.util.EmailWrapper)15 HashMap (java.util.HashMap)12 InvalidParametersException (teammates.common.exception.InvalidParametersException)10 EmailGenerator (teammates.logic.api.EmailGenerator)10 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)8 StatusMessage (teammates.common.util.StatusMessage)6 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)5 TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)4 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)4 EntityAlreadyExistsException (teammates.common.exception.EntityAlreadyExistsException)4 InstructorCoursesPageData (teammates.ui.pagedata.InstructorCoursesPageData)4 InstructorFeedbackSessionsPageData (teammates.ui.pagedata.InstructorFeedbackSessionsPageData)4