-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Reference by ID in GetCourseJoinStatusActionIT * Reference by ID in AccountRequestsDbIT * Reference by ID in AccountRequestsLogicIT * Reference by ID in CreateAccountActionIT * Reference by ID in BaseTestCaseWithSqlDatabaseAccess * Remove now irrelevant reference by email address and institute
- Loading branch information
1 parent
4682dff
commit c6b8642
Showing
6 changed files
with
12 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,9 @@ public void testCreateReadDeleteAccountRequest() throws Exception { | |
new AccountRequest("[email protected]", "name", "institute", AccountRequestStatus.PENDING, "comments"); | ||
accountRequestDb.createAccountRequest(accountRequest); | ||
|
||
______TS("Read account request using the given email and institute"); | ||
______TS("Read account request using the given ID"); | ||
|
||
AccountRequest actualAccReqEmalAndInstitute = | ||
accountRequestDb.getAccountRequest(accountRequest.getEmail(), accountRequest.getInstitute()); | ||
AccountRequest actualAccReqEmalAndInstitute = accountRequestDb.getAccountRequest(accountRequest.getId()); | ||
verifyEquals(accountRequest, actualAccReqEmalAndInstitute); | ||
|
||
______TS("Read account request using the given registration key"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import teammates.common.util.Const; | ||
import teammates.common.util.HibernateUtil; | ||
import teammates.storage.sqlentity.AccountRequest; | ||
import teammates.ui.output.JoinStatus; | ||
import teammates.ui.webapi.GetCourseJoinStatusAction; | ||
import teammates.ui.webapi.JsonResult; | ||
|
@@ -131,8 +132,8 @@ protected void testExecute() { | |
|
||
______TS("Normal case: account request not used, instructor has not joined course"); | ||
|
||
String accountRequestNotUsedKey = logic.getAccountRequest("[email protected]", | ||
"TEAMMATES Test Institute 1").getRegistrationKey(); | ||
AccountRequest unregisteredInstructor1AccountRequest = typicalBundle.accountRequests.get("unregisteredInstructor1"); | ||
String accountRequestNotUsedKey = unregisteredInstructor1AccountRequest.getRegistrationKey(); | ||
|
||
params = new String[] { | ||
Const.ParamsNames.REGKEY, accountRequestNotUsedKey, | ||
|
@@ -148,8 +149,8 @@ protected void testExecute() { | |
|
||
______TS("Normal case: account request already used, instructor has joined course"); | ||
|
||
String accountRequestUsedKey = | ||
logic.getAccountRequest("[email protected]", "TEAMMATES Test Institute 1").getRegistrationKey(); | ||
AccountRequest instructor1AccountRequest = typicalBundle.accountRequests.get("instructor1"); | ||
String accountRequestUsedKey = instructor1AccountRequest.getRegistrationKey(); | ||
|
||
params = new String[] { | ||
Const.ParamsNames.REGKEY, accountRequestUsedKey, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package teammates.storage.sqlapi; | ||
|
||
import static org.mockito.ArgumentMatchers.anyString; | ||
import static org.mockito.Mockito.doReturn; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.mockStatic; | ||
|
@@ -50,27 +49,14 @@ public void teardownMethod() { | |
} | ||
|
||
@Test | ||
public void testCreateAccountRequest_accountRequestDoesNotExist_success() throws InvalidParametersException { | ||
public void testCreateAccountRequest_typicalCase_success() throws InvalidParametersException { | ||
AccountRequest accountRequest = | ||
new AccountRequest("[email protected]", "name", "institute", AccountRequestStatus.PENDING, "comments"); | ||
doReturn(null).when(accountRequestDb).getAccountRequest(anyString(), anyString()); | ||
|
||
accountRequestDb.createAccountRequest(accountRequest); | ||
|
||
mockHibernateUtil.verify(() -> HibernateUtil.persist(accountRequest)); | ||
} | ||
|
||
@Test | ||
public void testCreateAccountRequest_accountRequestAlreadyExists_createsSuccessfully() | ||
throws InvalidParametersException { | ||
AccountRequest accountRequest = | ||
new AccountRequest("[email protected]", "name", "institute", AccountRequestStatus.PENDING, "comments"); | ||
doReturn(new AccountRequest("[email protected]", "name", "institute", AccountRequestStatus.PENDING, "comments")) | ||
.when(accountRequestDb).getAccountRequest(anyString(), anyString()); | ||
accountRequestDb.createAccountRequest(accountRequest); | ||
mockHibernateUtil.verify(() -> HibernateUtil.persist(accountRequest)); | ||
} | ||
|
||
@Test | ||
public void testGetAccountRequest_nonExistentAccountRequest_returnsNull() { | ||
UUID id = UUID.randomUUID(); | ||
|