fix auth login state race
This commit is contained in:
@@ -3269,6 +3269,31 @@ mod tests {
|
||||
assert_eq!(login_response.status(), StatusCode::OK);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn phone_auth_sms_provider_errors_keep_upstream_http_semantics() {
|
||||
let invalid_config = crate::phone_auth::map_phone_auth_error(
|
||||
module_auth::PhoneAuthError::SmsProviderInvalidConfig(
|
||||
"阿里云短信 AccessKeyId 未配置".to_string(),
|
||||
),
|
||||
);
|
||||
assert_eq!(
|
||||
invalid_config.status_code(),
|
||||
StatusCode::SERVICE_UNAVAILABLE
|
||||
);
|
||||
assert_eq!(invalid_config.message(), "阿里云短信 AccessKeyId 未配置");
|
||||
|
||||
let upstream = crate::phone_auth::map_phone_auth_error(
|
||||
module_auth::PhoneAuthError::SmsProviderUpstream(
|
||||
"短信验证码发送失败:check frequency failed".to_string(),
|
||||
),
|
||||
);
|
||||
assert_eq!(upstream.status_code(), StatusCode::BAD_GATEWAY);
|
||||
assert_eq!(
|
||||
upstream.message(),
|
||||
"短信验证码发送失败:check frequency failed"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn wechat_start_returns_mock_callback_url_with_state() {
|
||||
let config = AppConfig {
|
||||
|
||||
Reference in New Issue
Block a user