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");
}
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);
}
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()));
}
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());
}
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);
}
Aggregations