Skip to content

Commit

Permalink
adds missing check in userIdMapping tests (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jscyo authored Jul 26, 2022
1 parent 5c41179 commit 556f428
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import com.google.gson.JsonObject;
import io.supertokens.ProcessState;
import io.supertokens.emailpassword.EmailPassword;
import io.supertokens.pluginInterface.STORAGE_TYPE;
import io.supertokens.pluginInterface.emailpassword.UserInfo;
import io.supertokens.storageLayer.StorageLayer;
import io.supertokens.test.TestingProcessManager;
import io.supertokens.test.Utils;
import io.supertokens.test.httpRequest.HttpRequestForTesting;
Expand Down Expand Up @@ -56,6 +58,10 @@ public void testBadInput() throws Exception {
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

{
// do not pass userId
try {
Expand Down Expand Up @@ -130,6 +136,10 @@ public void testRetrievingUserIdMappingWithUnknownUserId() throws Exception {
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

{
// retrieve userId mapping with unknown userId with SUPERTOKENS as the userIdType
HashMap<String, String> QUERY_PARAM = new HashMap<>();
Expand Down Expand Up @@ -180,6 +190,10 @@ public void testRetrieveUserIdMapping() throws Exception {
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

// create a user and map their userId to an external userId
UserInfo user = EmailPassword.signUp(process.main, "[email protected]", "testPass123");
String superTokensUserId = user.id;
Expand Down Expand Up @@ -270,6 +284,10 @@ public void testRetrievingUserIdMappingWithoutSendingUserIdType() throws Excepti
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

// create a user and map their userId to an external userId
UserInfo user = EmailPassword.signUp(process.main, "[email protected]", "testPass123");
String superTokensUserId = user.id;
Expand Down Expand Up @@ -321,6 +339,10 @@ public void testRetrieveUserIdMappingWithExternalUserIdInfoAsNull() throws Excep
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

// create a user and map their userId to an external userId
UserInfo user = EmailPassword.signUp(process.main, "[email protected]", "testPass123");
String superTokensUserId = user.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ public void testDeletingAUserIdMappingWithoutSendingUserIdType() throws Exceptio
TestingProcessManager.TestingProcess process = TestingProcessManager.start(args);
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) {
return;
}

// create a userId mapping
UserInfo userInfo = EmailPassword.signUp(process.main, "[email protected]", "testPass123");
UserIdMapping userIdMapping = new UserIdMapping(userInfo.id, "externalUserId", "externalUserIdInfo");
Expand Down

0 comments on commit 556f428

Please sign in to comment.