mirror of
https://github.com/bitwarden/server.git
synced 2025-12-10 17:45:21 -06:00
Improve Swagger OperationIDs for Tools (#6239)
This commit is contained in:
parent
d2d3e0f11b
commit
0bfbfaa17c
@ -63,7 +63,7 @@ public class ImportCiphersController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("import-organization")]
|
[HttpPost("import-organization")]
|
||||||
public async Task PostImport([FromQuery] string organizationId,
|
public async Task PostImportOrganization([FromQuery] string organizationId,
|
||||||
[FromBody] ImportOrganizationCiphersRequestModel model)
|
[FromBody] ImportOrganizationCiphersRequestModel model)
|
||||||
{
|
{
|
||||||
if (!_globalSettings.SelfHosted &&
|
if (!_globalSettings.SelfHosted &&
|
||||||
|
|||||||
@ -192,7 +192,7 @@ public class SendsController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("")]
|
[HttpGet("")]
|
||||||
public async Task<ListResponseModel<SendResponseModel>> Get()
|
public async Task<ListResponseModel<SendResponseModel>> GetAll()
|
||||||
{
|
{
|
||||||
var userId = _userService.GetProperUserId(User).Value;
|
var userId = _userService.GetProperUserId(User).Value;
|
||||||
var sends = await _sendRepository.GetManyByUserIdAsync(userId);
|
var sends = await _sendRepository.GetManyByUserIdAsync(userId);
|
||||||
|
|||||||
@ -126,7 +126,7 @@ public class ImportCiphersControllerTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.PostImport(Arg.Any<string>(), model));
|
var exception = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.PostImportOrganization(Arg.Any<string>(), model));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal("You cannot import this much data at once.", exception.Message);
|
Assert.Equal("You cannot import this much data at once.", exception.Message);
|
||||||
@ -186,7 +186,7 @@ public class ImportCiphersControllerTests
|
|||||||
.Returns(existingCollections.Select(c => new Collection { Id = orgIdGuid }).ToList());
|
.Returns(existingCollections.Select(c => new Collection { Id = orgIdGuid }).ToList());
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await sutProvider.Sut.PostImport(orgId, request);
|
await sutProvider.Sut.PostImportOrganization(orgId, request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
@ -257,7 +257,7 @@ public class ImportCiphersControllerTests
|
|||||||
.Returns(existingCollections.Select(c => new Collection { Id = orgIdGuid }).ToList());
|
.Returns(existingCollections.Select(c => new Collection { Id = orgIdGuid }).ToList());
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await sutProvider.Sut.PostImport(orgId, request);
|
await sutProvider.Sut.PostImportOrganization(orgId, request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
@ -324,7 +324,7 @@ public class ImportCiphersControllerTests
|
|||||||
|
|
||||||
// Act
|
// Act
|
||||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
||||||
sutProvider.Sut.PostImport(orgId, request));
|
sutProvider.Sut.PostImportOrganization(orgId, request));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsType<Bit.Core.Exceptions.BadRequestException>(exception);
|
Assert.IsType<Bit.Core.Exceptions.BadRequestException>(exception);
|
||||||
@ -387,7 +387,7 @@ public class ImportCiphersControllerTests
|
|||||||
|
|
||||||
// Act
|
// Act
|
||||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
||||||
sutProvider.Sut.PostImport(orgId, request));
|
sutProvider.Sut.PostImportOrganization(orgId, request));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.IsType<Bit.Core.Exceptions.BadRequestException>(exception);
|
Assert.IsType<Bit.Core.Exceptions.BadRequestException>(exception);
|
||||||
@ -457,7 +457,7 @@ public class ImportCiphersControllerTests
|
|||||||
// Act
|
// Act
|
||||||
// User imports into collections and creates new collections
|
// User imports into collections and creates new collections
|
||||||
// User has ImportCiphers and Create ciphers permission
|
// User has ImportCiphers and Create ciphers permission
|
||||||
await sutProvider.Sut.PostImport(orgId.ToString(), request);
|
await sutProvider.Sut.PostImportOrganization(orgId.ToString(), request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
@ -535,7 +535,7 @@ public class ImportCiphersControllerTests
|
|||||||
// User has ImportCiphers permission only and doesn't have Create permission
|
// User has ImportCiphers permission only and doesn't have Create permission
|
||||||
var exception = await Assert.ThrowsAsync<BadRequestException>(async () =>
|
var exception = await Assert.ThrowsAsync<BadRequestException>(async () =>
|
||||||
{
|
{
|
||||||
await sutProvider.Sut.PostImport(orgId.ToString(), request);
|
await sutProvider.Sut.PostImportOrganization(orgId.ToString(), request);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@ -610,7 +610,7 @@ public class ImportCiphersControllerTests
|
|||||||
// Act
|
// Act
|
||||||
// User imports/creates a new collection - existing collections not affected
|
// User imports/creates a new collection - existing collections not affected
|
||||||
// User has create permissions and doesn't need import permissions
|
// User has create permissions and doesn't need import permissions
|
||||||
await sutProvider.Sut.PostImport(orgId.ToString(), request);
|
await sutProvider.Sut.PostImportOrganization(orgId.ToString(), request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
@ -685,7 +685,7 @@ public class ImportCiphersControllerTests
|
|||||||
// Act
|
// Act
|
||||||
// User import into existing collection
|
// User import into existing collection
|
||||||
// User has ImportCiphers permission only and doesn't need create permission
|
// User has ImportCiphers permission only and doesn't need create permission
|
||||||
await sutProvider.Sut.PostImport(orgId.ToString(), request);
|
await sutProvider.Sut.PostImportOrganization(orgId.ToString(), request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
@ -753,7 +753,7 @@ public class ImportCiphersControllerTests
|
|||||||
// import ciphers only and no collections
|
// import ciphers only and no collections
|
||||||
// User has Create permissions
|
// User has Create permissions
|
||||||
// expected to be successful
|
// expected to be successful
|
||||||
await sutProvider.Sut.PostImport(orgId.ToString(), request);
|
await sutProvider.Sut.PostImportOrganization(orgId.ToString(), request);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
await sutProvider.GetDependency<IImportCiphersCommand>()
|
await sutProvider.GetDependency<IImportCiphersCommand>()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user