Skip to content

Commit

Permalink
Add bvt reader tests (#3233)
Browse files Browse the repository at this point in the history
* Add bvt reader tests

* Add reader tests to authorization tests

* MAke bvt
  • Loading branch information
bcarthic authored Nov 30, 2023
1 parent 545116b commit bd8b40c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------
Expand All @@ -9,5 +9,7 @@ public static class TestApplications
{
public static TestApplication GlobalAdminServicePrincipal { get; } = new TestApplication("globalAdminServicePrincipal");

public static TestApplication GlobalReaderServicePrincipal { get; } = new TestApplication("globalReaderServicePrincipal");

public static TestApplication InvalidClient { get; } = new TestApplication("invalidClient");
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@
using System.Threading.Tasks;
using FellowOakDicom;
using Microsoft.Health.Dicom.Client;
using Microsoft.Health.Dicom.Client.Models;
using Microsoft.Health.Dicom.Core.Extensions;
using Microsoft.Health.Dicom.Core.Features.Partitioning;
using Microsoft.Health.Dicom.Tests.Common;
using Microsoft.Health.Dicom.Web.Tests.E2E.Common;
using Xunit;
using Partition = Microsoft.Health.Dicom.Core.Features.Partitioning.Partition;

namespace Microsoft.Health.Dicom.Web.Tests.E2E.Rest;

public class AuthorizationTests : IClassFixture<HttpIntegrationTestFixture<Startup>>
{
private readonly HttpIntegrationTestFixture<Startup> _fixture;
private readonly IDicomWebClient _clientV2WithReader;

public AuthorizationTests(HttpIntegrationTestFixture<Startup> fixture)
{
_fixture = fixture;
_clientV2WithReader = fixture.GetDicomWebClient(TestApplications.GlobalReaderServicePrincipal);
}

[Fact]
Expand All @@ -38,4 +41,20 @@ public async Task GivenPostDicomRequest_WithAReadOnlyToken_ReturnUnauthorized()
Assert.Equal(HttpStatusCode.Forbidden, exception.StatusCode);
}
}

[Fact]
[Trait("Category", "bvt")]
public async Task GivenSearchRequest_WithValidParamsAndNoMatchingResult_ReturnNoContent()
{
using DicomWebAsyncEnumerableResponse<DicomDataset> response = await _clientV2WithReader.QueryStudyAsync("StudyDate=20200101");
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
}

[Fact]
[Trait("Category", "bvt")]
public async Task GivenAValidQueryString_WhenRetrievingChangeFeedLatest_ThenReturnsSuccessfulStatusCode()
{
using DicomWebResponse<ChangeFeedEntry> response = await _clientV2WithReader.GetChangeFeedLatest();
Assert.True(response.IsSuccessStatusCode);
}
}

0 comments on commit bd8b40c

Please sign in to comment.