Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HansDahle committed Nov 14, 2024
1 parent b0713da commit 690ccaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ internal ApiPersonProfileV3 AddResourceOwner(string department)
var resourceOwner = this.AddProfile(FusionAccountType.Employee);

SetAsResourceOwner(resourceOwner, department);




return resourceOwner;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,15 @@ public async Task GetDepartments_Should_GetDelegatedResponsibles_FromGetDepartme
public async Task SearchShouldBeCaseInsensitive()
{
var fakeResourceOwner = fixture.AddProfile(FusionAccountType.Employee);
LineOrgServiceMock.AddTestUser().MergeWithProfile(fakeResourceOwner).AsResourceOwner().SaveProfile();
var orgUnit = fixture.SetAsResourceOwner(fakeResourceOwner, fakeResourceOwner.FullDepartment);


using var adminScope = fixture.AdminScope();

var resp = await Client.TestClientGetAsync<List<TestDepartment>>($"/departments?$search={fakeResourceOwner.Name.ToUpper()}");

resp.Response.StatusCode.Should().Be(HttpStatusCode.OK);
resp.Value.Should().Contain(x => x.Name == fakeResourceOwner.FullDepartment);
resp.Value.Should().Contain(x => x.Name == orgUnit.Name);
}

[Fact]
Expand Down Expand Up @@ -285,7 +286,7 @@ public async Task OptionsDepartmentResponsible_CanDelegateAccessToCurrentAndDown
fixture.EnsureDepartment(dep);

var testDepartment = "AAA BBB CCC XXX";
var resourceOwner = fixture.AddProfile(x => x.WithAccountType(FusionAccountType.Employee).AsResourceOwner().WithFullDepartment(testDepartment));
var resourceOwner = fixture.AddResourceOwner(testDepartment); // AddProfile(x => x.WithAccountType(FusionAccountType.Employee).AsResourceOwner().WithFullDepartment(testDepartment));
using var adminScope = fixture.UserScope(resourceOwner);

var result = await Client.TestClientOptionsAsync($"/departments/{fullDepartment}/delegated-resource-owners");
Expand All @@ -306,7 +307,7 @@ public async Task PostDepartmentResponsible_CanDelegateAccessToCurrentAndDownwar

var testDepartment = "AAA BBB CCC XXX";
var delegatedResourceOwner = fixture.AddProfile(FusionAccountType.Employee);
var resourceOwner = fixture.AddProfile(x => x.WithAccountType(FusionAccountType.Employee).AsResourceOwner().WithFullDepartment(testDepartment));
var resourceOwner = fixture.AddResourceOwner(testDepartment);
using var adminScope = fixture.UserScope(resourceOwner);

var result = await Client.TestClientPostAsync<dynamic>($"/departments/{fullDepartment}/delegated-resource-owners", new
Expand Down

0 comments on commit 690ccaf

Please sign in to comment.