1
0
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:
Bernd Schoolmann 2025-06-05 18:48:00 +02:00
parent af976cd515
commit cb9ff16f5a
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ public class UsersController(
IUserAccountKeysQuery _userAccountKeysQuery) : Controller IUserAccountKeysQuery _userAccountKeysQuery) : Controller
{ {
[HttpGet("{id}/public-key")] [HttpGet("{id}/public-key")]
public async Task<UserKeyResponseModel> GetPublicKey(string id) public async Task<UserKeyResponseModel> GetPublicKeyAsync(string id)
{ {
var guidId = new Guid(id); var guidId = new Guid(id);
var key = await _userRepository.GetPublicKeyAsync(guidId); var key = await _userRepository.GetPublicKeyAsync(guidId);
@ -28,7 +28,7 @@ public class UsersController(
} }
[HttpGet("{id}/keys")] [HttpGet("{id}/keys")]
public async Task<PublicKeysResponseModel> GetAccountKeys(string id) public async Task<PublicKeysResponseModel> GetAccountKeysAsync(string id)
{ {
var guidId = new Guid(id); var guidId = new Guid(id);
var user = await _userRepository.GetByIdAsync(guidId); var user = await _userRepository.GetByIdAsync(guidId);

View File

@ -25,7 +25,7 @@ public class UsersControllerTests
SutProvider<UsersController> sutProvider) SutProvider<UsersController> sutProvider)
{ {
sutProvider.GetDependency<IUserRepository>().GetPublicKeyAsync(Arg.Any<Guid>()).ReturnsNull(); 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] [Theory]
@ -34,7 +34,7 @@ public class UsersControllerTests
SutProvider<UsersController> sutProvider) SutProvider<UsersController> sutProvider)
{ {
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(Arg.Any<Guid>()).ReturnsNull(); 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] [Theory]
@ -53,7 +53,7 @@ public class UsersControllerTests
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user); sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user);
sutProvider.GetDependency<IUserSignatureKeyPairRepository>().GetByUserIdAsync(userId).Returns(new SignatureKeyPairData(SignatureAlgorithm.Ed25519, "wrappedSigningKey", "verifyingKey")); 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.NotNull(result);
Assert.Equal("publicKey", result.PublicKey); Assert.Equal("publicKey", result.PublicKey);
Assert.Equal("signedPublicKey", result.SignedPublicKey); Assert.Equal("signedPublicKey", result.SignedPublicKey);
@ -76,7 +76,7 @@ public class UsersControllerTests
sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user); sutProvider.GetDependency<IUserRepository>().GetByIdAsync(userId).Returns(user);
sutProvider.GetDependency<IUserSignatureKeyPairRepository>().GetByUserIdAsync(userId).ReturnsNull(); 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.NotNull(result);
Assert.Equal("publicKey", result.PublicKey); Assert.Equal("publicKey", result.PublicKey);
Assert.Null(result.SignedPublicKey); Assert.Null(result.SignedPublicKey);