mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 06:03:12 +08:00
fix: fixing tests and dotnet format
This commit is contained in:
@@ -35,7 +35,7 @@ public class SendEmailOtpRequestValidator(
|
||||
// It is an invalid request if the email is missing.
|
||||
if (string.IsNullOrEmpty(email))
|
||||
{
|
||||
// Request is the wrong shape and doesn't contain an email field.'
|
||||
// Request is the wrong shape and doesn't contain an email field.
|
||||
return BuildErrorResult(SendAccessConstants.EmailOtpValidatorResults.EmailRequired);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -83,7 +83,7 @@ public class SendEmailOtpRequestValidatorIntegrationTests(IdentityApplicationFac
|
||||
// Assert
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
Assert.Contains(OidcConstants.TokenErrors.InvalidRequest, content);
|
||||
Assert.Contains("email otp sent", content);
|
||||
Assert.Contains("email and otp are required", content);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SendNeverAuthenticateRequestValidatorIntegrationTests(
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SendAccess_NeverAuthenticateSend_WithEmail_ReturnsEmailInvalid()
|
||||
public async Task SendAccess_NeverAuthenticateSend_WithEmail_ReturnsEmailAndOtpRequired()
|
||||
{
|
||||
// Arrange
|
||||
var email = "test@example.com";
|
||||
@@ -77,10 +77,10 @@ public class SendNeverAuthenticateRequestValidatorIntegrationTests(
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// should be invalid grant
|
||||
Assert.Contains(OidcConstants.TokenErrors.InvalidGrant, content);
|
||||
Assert.Contains(OidcConstants.TokenErrors.InvalidRequest, content);
|
||||
|
||||
// Try to compel the invalid email error
|
||||
var expectedError = SendAccessConstants.EmailOtpValidatorResults.EmailInvalid;
|
||||
var expectedError = SendAccessConstants.EmailOtpValidatorResults.EmailAndOtpRequired;
|
||||
Assert.Contains(expectedError, content);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user