mirror of
https://github.com/bitwarden/server.git
synced 2025-04-21 04:55:08 -05:00
Adding missing test to projectscontroller (#3129)
This commit is contained in:
parent
9d4b98e787
commit
115ead00d4
@ -10,6 +10,7 @@ using Bit.Core.Enums;
|
|||||||
using Bit.Core.SecretsManager.Entities;
|
using Bit.Core.SecretsManager.Entities;
|
||||||
using Bit.Core.SecretsManager.Repositories;
|
using Bit.Core.SecretsManager.Repositories;
|
||||||
using Bit.Test.Common.Helpers;
|
using Bit.Test.Common.Helpers;
|
||||||
|
using Pipelines.Sockets.Unofficial.Arenas;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Bit.Api.IntegrationTest.SecretsManager.Controllers;
|
namespace Bit.Api.IntegrationTest.SecretsManager.Controllers;
|
||||||
@ -295,6 +296,25 @@ public class ProjectsControllerTests : IClassFixture<ApiApplicationFactory>, IAs
|
|||||||
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Get_NonExistingProject_NotFound()
|
||||||
|
{
|
||||||
|
var (org, _) = await _organizationHelper.Initialize(true, true);
|
||||||
|
var (email, _) = await _organizationHelper.CreateNewUser(OrganizationUserType.User, true);
|
||||||
|
await LoginAsync(email);
|
||||||
|
|
||||||
|
var createdProject = await _projectRepository.CreateAsync(new Project
|
||||||
|
{
|
||||||
|
OrganizationId = org.Id,
|
||||||
|
Name = _mockEncryptedString,
|
||||||
|
});
|
||||||
|
|
||||||
|
var deleteResponse = await _client.PostAsync("/projects/delete", JsonContent.Create(createdProject.Id));
|
||||||
|
|
||||||
|
var response = await _client.GetAsync($"/projects/{createdProject.Id}");
|
||||||
|
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(PermissionType.RunAsAdmin)]
|
[InlineData(PermissionType.RunAsAdmin)]
|
||||||
[InlineData(PermissionType.RunAsUserWithPermission)]
|
[InlineData(PermissionType.RunAsUserWithPermission)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user