-
Notifications
You must be signed in to change notification settings - Fork 541
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
2 changed files
with
26 additions
and
2 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 |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
import io.supertokens.authRecipe.exception.AccountInfoAlreadyAssociatedWithAnotherPrimaryUserIdException; | ||
import io.supertokens.emailpassword.EmailPassword; | ||
import io.supertokens.emailpassword.exceptions.EmailChangeNotAllowedException; | ||
import io.supertokens.emailpassword.exceptions.WrongCredentialsException; | ||
import io.supertokens.featureflag.EE_FEATURES; | ||
import io.supertokens.featureflag.FeatureFlagTestContent; | ||
import io.supertokens.featureflag.exceptions.FeatureNotEnabledException; | ||
|
@@ -256,6 +257,13 @@ public void testVariousCases() throws Exception { | |
new AssociateUserToTenant(t2, 0), | ||
new MakePrimaryUser(t1, 0), | ||
}), | ||
new TestCase(new TestCaseStep[]{ | ||
new CreateEmailPasswordUser(t1, "[email protected]"), | ||
new CreatePlessUserWithEmail(t2, "[email protected]"), | ||
new MakePrimaryUser(t1, 0), | ||
new LinkAccounts(t1, 0, 1), | ||
new SignInEmailPasswordUser(t2, 0).expect(new WrongCredentialsException()) | ||
}), | ||
|
||
new TestCase(new TestCaseStep[]{ | ||
new CreateEmailPasswordUser(t1, "[email protected]"), | ||
|
@@ -830,4 +838,20 @@ public void execute(Main main) throws Exception { | |
AuthRecipe.unlinkAccounts(main, tenantIdentifierWithStorage.toAppIdentifierWithStorage(), TestCase.users.get(userIndex).getSupertokensUserId()); | ||
} | ||
} | ||
|
||
private static class SignInEmailPasswordUser extends TestCaseStep { | ||
TenantIdentifier tenantIdentifier; | ||
int userIndex; | ||
|
||
public SignInEmailPasswordUser(TenantIdentifier tenantIdentifier, int userIndex) { | ||
this.tenantIdentifier = tenantIdentifier; | ||
this.userIndex = userIndex; | ||
} | ||
|
||
@Override | ||
public void execute(Main main) throws Exception { | ||
TenantIdentifierWithStorage tenantIdentifierWithStorage = tenantIdentifier.withStorage(StorageLayer.getStorage(tenantIdentifier, main)); | ||
EmailPassword.signIn(tenantIdentifierWithStorage, main, TestCase.users.get(userIndex).loginMethods[0].email, "password"); | ||
} | ||
} | ||
} |