mirror of
https://github.com/bitwarden/server.git
synced 2025-06-20 02:48:03 -05:00
Rename to include async suffix
This commit is contained in:
parent
af976cd515
commit
cb9ff16f5a
@ -15,7 +15,7 @@ public class UsersController(
|
||||
IUserAccountKeysQuery _userAccountKeysQuery) : Controller
|
||||
{
|
||||
[HttpGet("{id}/public-key")]
|
||||
public async Task<UserKeyResponseModel> GetPublicKey(string id)
|
||||
public async Task<UserKeyResponseModel> GetPublicKeyAsync(string id)
|
||||
{
|
||||
var guidId = new Guid(id);
|
||||
var key = await _userRepository.GetPublicKeyAsync(guidId);
|
||||
@ -28,7 +28,7 @@ public class UsersController(
|
||||
}
|
||||
|
||||
[HttpGet("{id}/keys")]
|
||||
public async Task<PublicKeysResponseModel> GetAccountKeys(string id)
|
||||
public async Task<PublicKeysResponseModel> GetAccountKeysAsync(string id)
|
||||
{
|
||||
var guidId = new Guid(id);
|
||||
var user = await _userRepository.GetByIdAsync(guidId);
|
||||
|
@ -25,7 +25,7 @@ public class UsersControllerTests
|
||||
SutProvider<UsersController> sutProvider)
|
||||
{
|
||||
sutProvider.GetDependency<IUserRepository>().GetPublicKeyAsync(Arg.Any<Guid>()).ReturnsNull();
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.GetPublicKey(new Guid().ToString()));
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.GetPublicKeyAsync(new Guid().ToString()));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -34,7 +34,7 @@ public class UsersControllerTests
|
||||
SutProvider<UsersController> sutProvider)
|
||||
{
|
||||
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(Arg.Any<Guid>()).ReturnsNull();
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.GetAccountKeys(new Guid().ToString()));
|
||||
await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.GetAccountKeysAsync(new Guid().ToString()));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@ -53,7 +53,7 @@ public class UsersControllerTests
|
||||
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user);
|
||||
sutProvider.GetDependency<IUserSignatureKeyPairRepository>().GetByUserIdAsync(userId).Returns(new SignatureKeyPairData(SignatureAlgorithm.Ed25519, "wrappedSigningKey", "verifyingKey"));
|
||||
|
||||
var result = await sutProvider.Sut.GetAccountKeys(userId.ToString());
|
||||
var result = await sutProvider.Sut.GetAccountKeysAsync(userId.ToString());
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("publicKey", result.PublicKey);
|
||||
Assert.Equal("signedPublicKey", result.SignedPublicKey);
|
||||
@ -76,7 +76,7 @@ public class UsersControllerTests
|
||||
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user);
|
||||
sutProvider.GetDependency<IUserSignatureKeyPairRepository>().GetByUserIdAsync(userId).ReturnsNull();
|
||||
|
||||
var result = await sutProvider.Sut.GetAccountKeys(userId.ToString());
|
||||
var result = await sutProvider.Sut.GetAccountKeysAsync(userId.ToString());
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("publicKey", result.PublicKey);
|
||||
Assert.Null(result.SignedPublicKey);
|
||||
|
Loading…
x
Reference in New Issue
Block a user