-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'theo/phone_number_verification' into 'master'
add sms_verification See merge request TankerHQ/sdk-rust!43
- Loading branch information
Showing
7 changed files
with
93 additions
and
13 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
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 |
---|---|---|
|
@@ -97,7 +97,7 @@ async fn check_email_verif_is_setup() -> Result<(), Error> { | |
let email = "[email protected]".to_string(); | ||
let verif = Verification::Email { | ||
email: email.clone(), | ||
verification_code: app.get_verification_code(&email).await?, | ||
verification_code: app.get_email_verification_code(&email).await?, | ||
}; | ||
|
||
let tanker = Core::new(app.make_options()).await?; | ||
|
@@ -112,6 +112,28 @@ async fn check_email_verif_is_setup() -> Result<(), Error> { | |
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn check_sms_verif_is_setup() -> Result<(), Error> { | ||
let app = TestApp::get().await; | ||
let id = &app.create_identity(None); | ||
let phone_number = "+33600001111".to_string(); | ||
let verif = Verification::PhoneNumber { | ||
phone_number: phone_number.clone(), | ||
verification_code: app.get_sms_verification_code(&phone_number).await?, | ||
}; | ||
|
||
let tanker = Core::new(app.make_options()).await?; | ||
tanker.start(&id).await?; | ||
tanker | ||
.register_identity(&verif, &VerificationOptions::new()) | ||
.await?; | ||
let methods = tanker.get_verification_methods().await?; | ||
tanker.stop().await?; | ||
|
||
assert_eq!(&methods, &[VerificationMethod::PhoneNumber(phone_number)]); | ||
Ok(()) | ||
} | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn unlock_with_verif_code() -> Result<(), Error> { | ||
let app = TestApp::get().await; | ||
|
@@ -122,7 +144,7 @@ async fn unlock_with_verif_code() -> Result<(), Error> { | |
tanker.start(&id).await?; | ||
let verif = Verification::Email { | ||
email: email.to_owned(), | ||
verification_code: app.get_verification_code(&email).await?, | ||
verification_code: app.get_email_verification_code(&email).await?, | ||
}; | ||
tanker | ||
.register_identity(&verif, &VerificationOptions::new()) | ||
|
@@ -133,7 +155,7 @@ async fn unlock_with_verif_code() -> Result<(), Error> { | |
tanker.start(&id).await?; | ||
let verif = Verification::Email { | ||
email: email.to_owned(), | ||
verification_code: app.get_verification_code(&email).await?, | ||
verification_code: app.get_email_verification_code(&email).await?, | ||
}; | ||
tanker | ||
.verify_identity(&verif, &VerificationOptions::new()) | ||
|