Search in sources :

Example 66 with AccountAttributes

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

the class StudentProfileCreateFormUrlActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    AccountAttributes student = typicalBundle.accounts.get("student1InCourse1");
    testGenerateUploadUrlSuccessTypical(student);
    testGenerateUploadUrlSuccessMasqueradeMode(student);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 67 with AccountAttributes

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

the class AccountAttributesTest method testBuilderWithPopulatedFieldValues.

@Test
public void testBuilderWithPopulatedFieldValues() {
    String expectedGoogleId = "dummyGoogleId";
    String expectedEmail = "email@example.com";
    String expectedName = "dummyName";
    String expectedInstitute = "dummyInstitute";
    // since false case is covered in default test
    boolean expectedIsInstructor = true;
    Instant expectedCreatedAt = Instant.ofEpochMilli(98765);
    AccountAttributes observedAccountAttributes = AccountAttributes.builder().withGoogleId(expectedGoogleId).withEmail(expectedEmail).withName(expectedName).withInstitute(expectedInstitute).withIsInstructor(expectedIsInstructor).withCreatedAt(expectedCreatedAt).withDefaultStudentProfileAttributes(expectedGoogleId).build();
    assertEquals(expectedGoogleId, observedAccountAttributes.getGoogleId());
    assertEquals(expectedEmail, observedAccountAttributes.getEmail());
    assertEquals(expectedCreatedAt, observedAccountAttributes.createdAt);
    assertEquals(expectedInstitute, observedAccountAttributes.getInstitute());
    assertEquals(expectedIsInstructor, observedAccountAttributes.isInstructor());
    assertEquals(expectedName, observedAccountAttributes.getName());
    assertEquals(expectedGoogleId, observedAccountAttributes.studentProfile.googleId);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Instant(java.time.Instant) Test(org.testng.annotations.Test)

Example 68 with AccountAttributes

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

the class AccountAttributesTest method testBuilderWithUnsanitisedFieldValues.

@Test
public void testBuilderWithUnsanitisedFieldValues() {
    AccountAttributes observedAccountAttributes = AccountAttributes.builder().withGoogleId("googleId@gmail.com").withName("  random  name with   extra spaces    ").withEmail("         email@example.com ").withInstitute("    random  institute name      with extra    spaces  ").withStudentProfileAttributes(StudentProfileAttributes.builder("googleId@gmail.com").build()).build();
    assertEquals("googleId", observedAccountAttributes.getGoogleId());
    assertEquals("random name with extra spaces", observedAccountAttributes.getName());
    assertEquals("email@example.com", observedAccountAttributes.getEmail());
    assertEquals("random institute name with extra spaces", observedAccountAttributes.getInstitute());
    assertEquals("googleId", observedAccountAttributes.studentProfile.googleId);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 69 with AccountAttributes

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

the class AccountAttributesTest method testToString.

@Test
public void testToString() {
    AccountAttributes account = createValidAccountAttributesObject();
    AccountAttributes account1 = createValidAccountAttributesObject();
    AccountAttributes account2 = createInvalidAccountAttributesObject();
    assertEquals(account.toString(), account1.toString());
    assertFalse("different accounts have different toString() values", account1.toString().equals(account2.toString()));
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 70 with AccountAttributes

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

the class AccountAttributesTest method testGetEntityTypeAsString.

@Test
public void testGetEntityTypeAsString() {
    AccountAttributes account = createValidAccountAttributesObject();
    assertEquals("Account", account.getEntityTypeAsString());
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Aggregations

AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)84 Test (org.testng.annotations.Test)53 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)28 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)16 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)15 ArrayList (java.util.ArrayList)13 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)11 HashMap (java.util.HashMap)7 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)6 InvalidParametersException (teammates.common.exception.InvalidParametersException)6 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)5 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)4 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)4 EmailWrapper (teammates.common.util.EmailWrapper)4 RedirectResult (teammates.ui.controller.RedirectResult)4 List (java.util.List)3 EmailGenerator (teammates.logic.api.EmailGenerator)3 AccountsDb (teammates.storage.api.AccountsDb)3 Account (teammates.storage.entity.Account)3 ShowPageResult (teammates.ui.controller.ShowPageResult)3