Migration implementation (part 2)
This commit is contained in:
@@ -14,6 +14,25 @@ use super::{AssertResult, ImapConnection, Type};
|
||||
pub async fn test(imap: &mut ImapConnection, _imap_check: &mut ImapConnection) {
|
||||
println!("Running basic tests...");
|
||||
|
||||
// Test OAuth Bearer decoding
|
||||
assert!(
|
||||
Credentials::OAuthBearer {
|
||||
token: "vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==".to_string()
|
||||
} == sasl_decode_challenge_oauth(
|
||||
&base64_decode(
|
||||
concat!(
|
||||
"bixhPXVzZXJAZXhhbXBsZS5jb20sAWhv",
|
||||
"c3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyI",
|
||||
"HZGOWRmdDRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQ",
|
||||
"EB"
|
||||
)
|
||||
.as_bytes(),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap()
|
||||
);
|
||||
|
||||
// Test CAPABILITY
|
||||
imap.send("CAPABILITY").await;
|
||||
imap.assert_read(Type::Tagged, ResponseType::Ok).await;
|
||||
@@ -38,24 +57,3 @@ pub async fn test(imap: &mut ImapConnection, _imap_check: &mut ImapConnection) {
|
||||
imap.send_untagged("AGJvYXR5AG1jYm9hdGZhY2U=").await;
|
||||
imap.assert_read(Type::Tagged, ResponseType::No).await;
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn decode_challenge() {
|
||||
assert!(
|
||||
Credentials::OAuthBearer {
|
||||
token: "vF9dft4qmTc2Nvb3RlckBhbHRhdmlzdGEuY29tCg==".to_string()
|
||||
} == sasl_decode_challenge_oauth(
|
||||
&base64_decode(
|
||||
concat!(
|
||||
"bixhPXVzZXJAZXhhbXBsZS5jb20sAWhv",
|
||||
"c3Q9c2VydmVyLmV4YW1wbGUuY29tAXBvcnQ9MTQzAWF1dGg9QmVhcmVyI",
|
||||
"HZGOWRmdDRxbVRjMk52YjNSbGNrQmhiSFJoZG1semRHRXVZMjl0Q2c9PQ",
|
||||
"EB"
|
||||
)
|
||||
.as_bytes(),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user