From 20a2fad5a605de1eb9e41c02eafcd56bebc956f3 Mon Sep 17 00:00:00 2001 From: "Rieb, Elias" Date: Tue, 30 Jul 2024 14:21:18 +0200 Subject: [PATCH] RELTEC-11165: Fix tests --- ...ry_configuration_patch_dto_merge_config.go | 18 --------- .../service/repositories/repositories_test.go | 37 ++++++------------- 2 files changed, 12 insertions(+), 43 deletions(-) delete mode 100644 api/generated_model_repository_configuration_patch_dto_merge_config.go diff --git a/api/generated_model_repository_configuration_patch_dto_merge_config.go b/api/generated_model_repository_configuration_patch_dto_merge_config.go deleted file mode 100644 index e94791a..0000000 --- a/api/generated_model_repository_configuration_patch_dto_merge_config.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Metadata - -Obtain and manage metadata for owners, services, repositories. Please see [README](https://github.com/Interhyp/metadata-service/blob/main/README.md) for details. **CLIENTS MUST READ!** - -API version: v1 -Contact: somebody@some-organisation.com -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -// RepositoryConfigurationPatchDtoMergeConfig struct for RepositoryConfigurationPatchDtoMergeConfig -type RepositoryConfigurationPatchDtoMergeConfig struct { - DefaultStrategy *MergeStrategy `yaml:"defaultStrategy,omitempty" json:"defaultStrategy,omitempty"` - Strategies []MergeStrategy `yaml:"strategies,omitempty" json:"strategies,omitempty"` -} diff --git a/internal/service/repositories/repositories_test.go b/internal/service/repositories/repositories_test.go index a674e9e..b4e03eb 100644 --- a/internal/service/repositories/repositories_test.go +++ b/internal/service/repositories/repositories_test.go @@ -2,6 +2,9 @@ package repositories import ( "context" + "testing" + "time" + "github.com/Interhyp/metadata-service/api" "github.com/Interhyp/metadata-service/internal/acorn/service" "github.com/Interhyp/metadata-service/internal/service/owners" @@ -11,8 +14,6 @@ import ( "github.com/StephanHCB/go-backend-service-common/repository/timestamp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "testing" - "time" ) func ptr[T any](v T) *T { @@ -59,10 +60,8 @@ func createRepositoryConfigurationDto() *openapi.RepositoryConfigurationDto { }, }, }, - Approvers: map[string][]string{"group": {"approver1"}}, - DefaultReviewers: []string{"defaultreviewer1"}, - SignedApprovers: []string{"signedapprover1"}, - Archived: ptr(false), + Approvers: map[string][]string{"group": {"approver1"}}, + Archived: ptr(false), } } func createRepositoryConfigurationPatchDtoFromConfigurationDto(input *openapi.RepositoryConfigurationDto) *openapi.RepositoryConfigurationPatchDto { @@ -72,8 +71,6 @@ func createRepositoryConfigurationPatchDtoFromConfigurationDto(input *openapi.Re RequireSuccessfulBuilds: input.RequireSuccessfulBuilds, Webhooks: input.Webhooks, Approvers: input.Approvers, - DefaultReviewers: input.DefaultReviewers, - SignedApprovers: input.SignedApprovers, Archived: input.Archived, } } @@ -153,10 +150,8 @@ func TestPatchRepository_ReplaceAll(t *testing.T) { }, }, }, - Approvers: map[string][]string{"group": {"newapprover1"}}, - DefaultReviewers: []string{"newdefaultreviewer1"}, - SignedApprovers: []string{"newsignedapprover1"}, - Archived: ptr(true), + Approvers: map[string][]string{"group": {"newapprover1"}}, + Archived: ptr(true), }, Filecategory: map[string][]string{"b": {"b.yaml", "b.json"}}, Labels: map[string]string{"label": "patchedValue"}, @@ -190,10 +185,8 @@ func TestPatchRepository_ReplaceAll(t *testing.T) { }, }, }, - Approvers: map[string][]string{"group": {"newapprover1"}}, - DefaultReviewers: []string{"newdefaultreviewer1"}, - SignedApprovers: []string{"newsignedapprover1"}, - Archived: ptr(true), + Approvers: map[string][]string{"group": {"newapprover1"}}, + Archived: ptr(true), }, Filecategory: map[string][]string{"b": {"b.yaml", "b.json"}}, Labels: map[string]string{"label": "patchedValue"}, @@ -215,9 +208,7 @@ func TestPatchRepository_ClearFields(t *testing.T) { Webhooks: &openapi.RepositoryConfigurationWebhooksDto{ Additional: []openapi.RepositoryConfigurationWebhookDto{}, }, - Approvers: map[string][]string{}, - DefaultReviewers: []string{}, - SignedApprovers: []string{}, + Approvers: map[string][]string{}, }, Filecategory: map[string][]string{}, Labels: map[string]string{}, @@ -237,10 +228,8 @@ func TestPatchRepository_ClearFields(t *testing.T) { Webhooks: &openapi.RepositoryConfigurationWebhooksDto{ Additional: nil, }, - Approvers: nil, - DefaultReviewers: nil, - SignedApprovers: nil, - Archived: ptr(false), + Approvers: nil, + Archived: ptr(false), }, Filecategory: nil, Labels: nil, @@ -487,7 +476,5 @@ func createRepositoryConfigDto(testApprovers map[string][]string) *openapi.Repos Webhooks: nil, Approvers: testApprovers, Watchers: nil, - DefaultReviewers: nil, - SignedApprovers: nil, } }