-
Notifications
You must be signed in to change notification settings - Fork 18
[OpenAPI] Add endpoint for create new admin resource details #307 #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OpenAPI] Add endpoint for create new admin resource details #307 #313
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단 admin 태그로 다 넣죠. 따로 resource 태그를 만들 필요는 없을 것 같아요.
test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminCreateResourcesOpenApiTests.cs
Show resolved
Hide resolved
resource 태그는 따로 만들지 않고,
|
[질문] 1. 기존 방식 (#231)사용되지 않는 파라미터를 [Theory]
[MemberData(nameof(AttributeData))]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Type(string attribute, bool isRequired, string type)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("apiapp");
// 경고 방지를 위한 임시 할당 (실제로 사용되지 않음)
var isReq = isRequired;
var typeStr = type;
// Act & Assert 생략
} 2. Discard 패턴 사용
[Theory]
[MemberData(nameof(AttributeData))]
public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Type(string attribute, bool _1, string _2)
{
// Arrange
using var httpClient = host.App!.CreateHttpClient("apiapp");
// Act & Assert 생략
} |
읭? 쓰이지 않는 파라미터 혹은 변수를 굳이 정의하는 이유가 있나요? 거기서부터 시작해야 할텐데? |
여러 테스트에서 동일한 AttributeData를 참조하고 있는데, 테스트 종류에 따라 필요한 파라미터가 다르다 보니, 사용되지 않는 파라미터도 함께 전달되고 있습니다.
기존 테스트 코드 스타일을 유지하기 위해 [MemberData(nameof(AttributeData))]를 활용했는데, [InlineData]를 사용하는 것이 더 나을까요? |
해당 개체의 구조가 내 테스트에 맞지 않다면 다른 형태로 테스트를 작성하는 게 맞다고 생각해요. |
네, 현재 제가 테스트하려는 모델의 구조가
여기서
|
그러면 굳이 기존의 |
기존의 1. 각 테스트에 필요한 개체 따로 생성
2. 한 개체를 여러 테스트가 함께 공유(불필요한 파라미터는
|
제가 가장 선호하는 방식은 한눈에 바로 들어오는 3번이긴 한데, 1번처럼 해도 괜찮을 듯 합니다. |
저도 여러 개체를 생성하는 1번 방식보다는 3번 방식처럼 [InlineData]를 사용하는 것이 더 깔끔하다고 생각해서, [MemberData]를 [InlineData]로 변경하고 불필요한 파라미터도 제거했습니다. 현재 수정된 코드는 같은 폴더 내 다른 테스트 코드와 스타일이 다릅니다. 이 파일도 같은 방식으로 수정해야 할까요? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다! LGTM!
Issue
#307 (참조 PR #261, #231)
Summary of Changes
1.
src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEndpointUrls.cs
2.
src/AzureOpenAIProxy.ApiApp/Endpoints/AdminResourceEndpoints.cs
3.
src/AzureOpenAIProxy.ApiApp/Program.cs
4.
test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminCreateResourcesOpenApiTests.cs
질문
admin
태그에 events와 resources가 함께 분류되어 있습니다.