-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
308 additions
and
9 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
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 |
---|---|---|
|
@@ -159,6 +159,10 @@ public void makeEmailPasswordPrimaryUserSuccess() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo emailPasswordUser = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
"pass1234"); | ||
|
||
|
@@ -191,6 +195,10 @@ public void makeThirdPartyPrimaryUserSuccess() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
ThirdParty.SignInUpResponse signInUp = ThirdParty.signInUp(process.getProcess(), "google", | ||
"user-google", | ||
"[email protected]"); | ||
|
@@ -226,6 +234,10 @@ public void makePasswordlessEmailPrimaryUserSuccess() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
Passwordless.CreateCodeResponse code = Passwordless.createCode(process.getProcess(), "[email protected]", null, null, | ||
null); | ||
Passwordless.ConsumeCodeResponse pResp = Passwordless.consumeCode(process.getProcess(), code.deviceId, | ||
|
@@ -261,6 +273,10 @@ public void makePasswordlessPhonePrimaryUserSuccess() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
Passwordless.CreateCodeResponse code = Passwordless.createCode(process.getProcess(), null, "1234", null, | ||
null); | ||
Passwordless.ConsumeCodeResponse pResp = Passwordless.consumeCode(process.getProcess(), code.deviceId, | ||
|
@@ -296,6 +312,10 @@ public void alreadyPrimaryUsertest() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo emailPasswordUser = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
"pass1234"); | ||
|
||
|
@@ -332,6 +352,10 @@ public void makePrimaryUserFailsCauseAnotherAccountWithSameEmailAlreadyAPrimaryU | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo emailPasswordUser = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
"pass1234"); | ||
|
||
|
@@ -363,6 +387,10 @@ public void makePrimarySucceedsEvenIfAnotherAccountWithSameEmailButIsNotAPrimary | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo emailPasswordUser = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
"pass1234"); | ||
|
||
|
@@ -387,6 +415,10 @@ public void makePrimaryUserFailsCauseAnotherAccountWithSameEmailAlreadyAPrimaryU | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
Multitenancy.addNewOrUpdateAppOrTenant(process.main, new TenantIdentifier(null, null, null), | ||
new TenantConfig(new TenantIdentifier(null, null, "t1"), new EmailPasswordConfig(true), | ||
new ThirdPartyConfig(true, new ThirdPartyConfig.Provider[0]), new PasswordlessConfig(true), | ||
|
@@ -429,6 +461,10 @@ public void makePrimarySucceedsEvenIfAnotherAccountWithSameEmailButInADifferentT | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
Multitenancy.addNewOrUpdateAppOrTenant(process.main, new TenantIdentifier(null, null, null), | ||
new TenantConfig(new TenantIdentifier(null, null, "t1"), new EmailPasswordConfig(true), | ||
new ThirdPartyConfig(true, new ThirdPartyConfig.Provider[0]), new PasswordlessConfig(true), | ||
|
@@ -463,6 +499,10 @@ public void makePrimaryUserFailsCauseOfUnknownUserId() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
try { | ||
AuthRecipe.createPrimaryUser(process.main, "random"); | ||
assert (false); | ||
|
@@ -483,6 +523,10 @@ public void makingPrimaryUserFailsCauseAlreadyLinkedToAnotherAccount() throws Ex | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo emailPasswordUser1 = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
"pass1234"); | ||
AuthRecipeUserInfo emailPasswordUser2 = EmailPassword.signUp(process.getProcess(), "[email protected]", | ||
|
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import io.supertokens.passwordless.Passwordless; | ||
import io.supertokens.passwordless.exceptions.*; | ||
import io.supertokens.pluginInterface.RECIPE_ID; | ||
import io.supertokens.pluginInterface.STORAGE_TYPE; | ||
import io.supertokens.pluginInterface.authRecipe.AuthRecipeUserInfo; | ||
import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; | ||
import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
|
@@ -104,6 +105,10 @@ public void testListUsersByAccountInfoForUnlinkedAccounts() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
AuthRecipeUserInfo user2 = createThirdPartyUser(process.getProcess(), "google", "userid1", "[email protected]"); | ||
AuthRecipeUserInfo user3 = createPasswordlessUserWithEmail(process.getProcess(), "[email protected]"); | ||
|
@@ -151,6 +156,10 @@ public void testListUsersByAccountInfoForUnlinkedAccountsWithUnionOption() throw | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
AuthRecipeUserInfo user2 = createThirdPartyUser(process.getProcess(), "google", "userid1", "[email protected]"); | ||
AuthRecipeUserInfo user3 = createPasswordlessUserWithEmail(process.getProcess(), "[email protected]"); | ||
|
@@ -197,6 +206,10 @@ public void testUnknownAccountInfo() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
TenantIdentifierWithStorage tenantIdentifierWithStorage = TenantIdentifier.BASE_TENANT.withStorage(StorageLayer.getBaseStorage(process.getProcess())); | ||
assertEquals(0, AuthRecipe.getUsersByAccountInfo(tenantIdentifierWithStorage, false, "[email protected]", null, null, null).length); | ||
assertEquals(0, AuthRecipe.getUsersByAccountInfo(tenantIdentifierWithStorage, false, null, null, "google", "userid1").length); | ||
|
@@ -217,6 +230,10 @@ public void testListUserByAccountInfoWhenAccountsAreLinked1() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = EmailPassword.signUp(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = ThirdParty.signInUp(process.getProcess(), "google", "userid1", "[email protected]").user; | ||
|
@@ -254,6 +271,10 @@ public void testListUserByAccountInfoWhenAccountsAreLinked2() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = EmailPassword.signUp(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = EmailPassword.signUp(process.getProcess(), "[email protected]", "password2"); | ||
|
@@ -285,6 +306,10 @@ public void testListUserByAccountInfoWhenAccountsAreLinked3() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = createPasswordlessUserWithEmail(process.getProcess(), "[email protected]"); | ||
|
@@ -316,6 +341,10 @@ public void testListUserByAccountInfoWhenAccountsAreLinked4() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = createPasswordlessUserWithPhone(process.getProcess(), "+919876543210"); | ||
|
@@ -349,6 +378,10 @@ public void testListUserByAccountInfoWhenAccountsAreLinked5() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = createThirdPartyUser(process.getProcess(), "google", "userid1", "[email protected]"); | ||
|
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 |
---|---|---|
|
@@ -26,11 +26,13 @@ | |
import io.supertokens.passwordless.Passwordless; | ||
import io.supertokens.passwordless.exceptions.*; | ||
import io.supertokens.pluginInterface.RECIPE_ID; | ||
import io.supertokens.pluginInterface.STORAGE_TYPE; | ||
import io.supertokens.pluginInterface.authRecipe.AuthRecipeUserInfo; | ||
import io.supertokens.pluginInterface.emailpassword.exceptions.DuplicateEmailException; | ||
import io.supertokens.pluginInterface.exceptions.StorageQueryException; | ||
import io.supertokens.pluginInterface.exceptions.StorageTransactionLogicException; | ||
import io.supertokens.pluginInterface.passwordless.exception.DuplicateLinkCodeHashException; | ||
import io.supertokens.storageLayer.StorageLayer; | ||
import io.supertokens.test.TestingProcessManager; | ||
import io.supertokens.test.Utils; | ||
import io.supertokens.thirdparty.ThirdParty; | ||
|
@@ -102,6 +104,10 @@ public void testAllLoginMethods() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
AuthRecipeUserInfo user1 = createEmailPasswordUser(process.getProcess(), "[email protected]", "password1"); | ||
Thread.sleep(50); | ||
AuthRecipeUserInfo user2 = createThirdPartyUser(process.getProcess(), "google", "userid1", "[email protected]"); | ||
|
@@ -162,6 +168,10 @@ public void testUnknownUserIdReturnsNull() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
assertNull(AuthRecipe.getUserById(process.getProcess(), "unknownid")); | ||
|
||
process.kill(); | ||
|
@@ -179,6 +189,10 @@ public void testLoginMethodsAreSortedByTime() throws Exception { | |
process.startProcess(); | ||
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED)); | ||
|
||
if (StorageLayer.getStorage(process.getProcess()).getType() != STORAGE_TYPE.SQL) { | ||
return; | ||
} | ||
|
||
// Create users | ||
AuthRecipeUserInfo user4 = createPasswordlessUserWithPhone(process.getProcess(), "+919876543210"); | ||
Thread.sleep(50); | ||
|
Oops, something went wrong.