diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml new file mode 100644 index 0000000..a6b4236 --- /dev/null +++ b/.github/workflows/publish-ghcr.yml @@ -0,0 +1,58 @@ +name: Create and publish a Docker image + +on: + push + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + APP_NAME: ${{ github.event.repository.name }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Read version from file + id: version_reader + run: | + VERSION=$(cat .version) + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }} + ${{ github.ref == 'refs/heads/main' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || ''}} + labels: | + org.opencontainers.image.title=${{ env.IMAGE_NAME }} + org.opencontainers.image.version=${{ steps.version_reader.outputs.version }} + build-args: | + app_name=${{ env.APP_NAME }} + version=${{ steps.version_reader.outputs.version }} + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.version b/.version index e230c83..1e20ec3 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -5.3.0 \ No newline at end of file +5.4.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0991f4c..333fc0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### v5.4.0 +* Добавлен новый endpoint: `/access_list/delete_list` для удаления методов из списка доступов у приложений +### v5.3.1 +* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry` +* обновлены зависимости ### v5.3.0 * Добавлен новый endpoint: `/application/get_application_by_token` ### v5.2.1 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba7ed1d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM golang:1.24-alpine3.20 AS builder +WORKDIR /build +ARG version +ENV version_env=$version +ARG app_name +ENV app_name_env=$app_name +COPY . . +RUN go build -ldflags="-X 'main.version=$version_env'" -o /main . + +FROM alpine:3.20 AS runner + +RUN apk add --no-cache tzdata && \ + cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime && \ + echo "Europe/Moscow" > /etc/timezone + +ARG UID=10001 +ARG GID=10001 + +RUN addgroup -g ${GID} appuser +RUN adduser \ + -D \ + -h "/nonexistent" \ + -s "/sbin/nologin" \ + -u "${UID}" \ + -G appuser \ + appuser + +RUN mkdir -p /app/data +RUN chown appuser:appuser /app/data +VOLUME /app/data + +USER appuser + +WORKDIR /app + +ARG app_name +ENV app_name_env=$app_name +COPY --from=builder main /app/$app_name_env +COPY /conf/config.yml /app/config.yml +COPY /conf/default_remote_config.json* /app/default_remote_config.json +COPY /migrations /app/migrations + +ENTRYPOINT /app/$app_name_env diff --git a/assembly/assembly.go b/assembly/assembly.go index e636754..23fe206 100644 --- a/assembly/assembly.go +++ b/assembly/assembly.go @@ -2,8 +2,11 @@ package assembly import ( "context" + "github.com/txix-open/isp-kit/rc" + "isp-system-service/conf" + "github.com/pkg/errors" "github.com/txix-open/isp-kit/app" "github.com/txix-open/isp-kit/bootstrap" @@ -12,7 +15,6 @@ import ( "github.com/txix-open/isp-kit/dbx" "github.com/txix-open/isp-kit/grpc" "github.com/txix-open/isp-kit/log" - "isp-system-service/conf" ) type Assembly struct { diff --git a/controller/access_list.go b/controller/access_list.go index 6ee48e1..1cdaa16 100644 --- a/controller/access_list.go +++ b/controller/access_list.go @@ -15,6 +15,7 @@ type AccessListService interface { GetById(ctx context.Context, appId int) ([]domain.MethodInfo, error) SetOne(ctx context.Context, request domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error) SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error) + DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error } type AccessList struct { @@ -113,3 +114,30 @@ func (c AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq return result, nil } } + +// DeleteList godoc +// +// @Tags accessList +// @Summary Удалить список доступных методов для приложения +// @Description Удаляет заданный список методов для приложения +// @Accept json +// @Produce json +// @Param body body domain.AccessListDeleteListRequest false "тело запроса" +// @Success 200 {object} any +// @Failure 404 {object} apierrors.Error +// @Failure 500 {object} apierrors.Error +// @Router /access_list/delete_list [POST] +func (c AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error { + err := c.service.DeleteList(ctx, req) + switch { + case errors.Is(err, domain.ErrApplicationNotFound): + return apierrors.New( + codes.NotFound, + domain.ErrCodeApplicationNotFound, + fmt.Sprintf("application with id %d not found", req.AppId), + err, + ) + default: + return err + } +} diff --git a/controller/secure.go b/controller/secure.go index 02b0144..5b5c0f0 100644 --- a/controller/secure.go +++ b/controller/secure.go @@ -3,8 +3,9 @@ package controller import ( "context" - "github.com/pkg/errors" "isp-system-service/domain" + + "github.com/pkg/errors" ) type SecureService interface { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 423ae7d..a82c173 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -10,6 +10,19 @@ definitions: errorMessage: type: string type: object + domain.AccessListDeleteListRequest: + properties: + appId: + type: integer + methods: + items: + type: string + minItems: 1 + type: array + required: + - appId + - methods + type: object domain.AccessListSetListRequest: properties: appId: @@ -389,6 +402,34 @@ info: title: isp-system-service version: 1.0.0 paths: + /access_list/delete_list: + post: + consumes: + - application/json + description: Удаляет заданный список методов для приложения + parameters: + - description: тело запроса + in: body + name: body + schema: + $ref: '#/definitions/domain.AccessListDeleteListRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: {} + "404": + description: Not Found + schema: + $ref: '#/definitions/apierrors.Error' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/apierrors.Error' + summary: Удалить список доступных методов для приложения + tags: + - accessList /access_list/get_by_id: post: consumes: diff --git a/domain/access_list.go b/domain/access_list.go index c7fba41..d822181 100644 --- a/domain/access_list.go +++ b/domain/access_list.go @@ -20,3 +20,8 @@ type MethodInfo struct { Method string Value bool } + +type AccessListDeleteListRequest struct { + AppId int `validate:"required"` + Methods []string `validate:"required,min=1"` +} diff --git a/go.mod b/go.mod index 72c458d..92a2a35 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/jackc/pgx/v5 v5.7.4 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.10.0 - github.com/txix-open/isp-kit v1.48.1 + github.com/txix-open/isp-kit v1.51.0 github.com/txix-open/jsonschema v1.3.0 google.golang.org/grpc v1.72.0 ) diff --git a/go.sum b/go.sum index d014963..b3a3d1e 100644 --- a/go.sum +++ b/go.sum @@ -144,10 +144,10 @@ github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgj github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o= github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA= github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8= -github.com/txix-open/grmq v1.8.0 h1:YXTruBap7EQZ6WNOhjoFqx/XBYMBhgeYM4mzNkX+bzU= -github.com/txix-open/grmq v1.8.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= -github.com/txix-open/isp-kit v1.48.1 h1:LZGZSpjUIaUfUQOGOHgRm9Q977su/C/rv3bI4w+x9iw= -github.com/txix-open/isp-kit v1.48.1/go.mod h1:qp0pbpsUqaAKhYGKGArYnBd0u7UBYuh561Q4MFkEqgs= +github.com/txix-open/grmq v1.8.1 h1:bcPLuYZXJ+1h9D3w7JYzUTypnQsw9XAT0Ftl/Fu+cZA= +github.com/txix-open/grmq v1.8.1/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po= +github.com/txix-open/isp-kit v1.51.0 h1:sSDs/M5EaAiIJGbefRprbZH2GgCfdjwgpUV94NWd73A= +github.com/txix-open/isp-kit v1.51.0/go.mod h1:OkscabRkpFGjUOFrbPM7yTKD/Br2/iv5/PWr/T2Jtd4= github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4= github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00= github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0= diff --git a/main.go b/main.go index f625bd4..09aa1e1 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,12 @@ package main import ( - "github.com/txix-open/isp-kit/bootstrap" - "github.com/txix-open/isp-kit/shutdown" "isp-system-service/assembly" "isp-system-service/conf" "isp-system-service/routes" + + "github.com/txix-open/isp-kit/bootstrap" + "github.com/txix-open/isp-kit/shutdown" ) var ( diff --git a/repository/access_list.go b/repository/access_list.go index 1799a03..6a33af1 100644 --- a/repository/access_list.go +++ b/repository/access_list.go @@ -4,12 +4,13 @@ import ( "context" "database/sql" + "isp-system-service/domain" + "isp-system-service/entity" + "github.com/Masterminds/squirrel" "github.com/pkg/errors" "github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db/query" - "isp-system-service/domain" - "isp-system-service/entity" ) type AccessList struct { diff --git a/repository/domain.go b/repository/domain.go index 8c85251..404543e 100644 --- a/repository/domain.go +++ b/repository/domain.go @@ -4,12 +4,13 @@ import ( "context" "database/sql" + "isp-system-service/domain" + "isp-system-service/entity" + "github.com/Masterminds/squirrel" "github.com/pkg/errors" "github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db/query" - "isp-system-service/domain" - "isp-system-service/entity" ) type Domain struct { diff --git a/repository/token.go b/repository/token.go index 810c5b8..fbb15f8 100644 --- a/repository/token.go +++ b/repository/token.go @@ -4,12 +4,13 @@ import ( "context" "database/sql" + "isp-system-service/domain" + "isp-system-service/entity" + "github.com/Masterminds/squirrel" "github.com/pkg/errors" "github.com/txix-open/isp-kit/db" "github.com/txix-open/isp-kit/db/query" - "isp-system-service/domain" - "isp-system-service/entity" ) type Token struct { diff --git a/routes/routes.go b/routes/routes.go index 4115fd2..2fb439a 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -1,10 +1,11 @@ package routes import ( + "isp-system-service/controller" + "github.com/txix-open/isp-kit/cluster" "github.com/txix-open/isp-kit/grpc" "github.com/txix-open/isp-kit/grpc/endpoint" - "isp-system-service/controller" ) type Controllers struct { @@ -73,6 +74,11 @@ func accessListCluster(c Controllers) []cluster.EndpointDescriptor { Inner: true, Handler: c.AccessList.SetList, }, + { + Path: "system/access_list/delete_list", + Inner: true, + Handler: c.AccessList.DeleteList, + }, } } diff --git a/service/access_list.go b/service/access_list.go index adf9692..c1157ca 100644 --- a/service/access_list.go +++ b/service/access_list.go @@ -11,6 +11,7 @@ import ( type AccessListRepo interface { GetAccessListByAppId(ctx context.Context, appId int) ([]entity.AccessList, error) + DeleteAccessList(ctx context.Context, appId int, methods []string) error } type AccessListSetOneTx interface { @@ -155,3 +156,15 @@ func (s AccessList) SetList(ctx context.Context, req domain.AccessListSetListReq return methodInfos, nil } + +func (s AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error { + _, err := s.appRepo.GetApplicationById(ctx, req.AppId) + if err != nil { + return errors.WithMessage(err, "get application by id") + } + err = s.accessListRepo.DeleteAccessList(ctx, req.AppId, req.Methods) + if err != nil { + return errors.WithMessage(err, "delete access_list") + } + return nil +} diff --git a/service/domain.go b/service/domain.go index ca58c24..c0fa211 100644 --- a/service/domain.go +++ b/service/domain.go @@ -3,9 +3,10 @@ package service import ( "context" - "github.com/pkg/errors" "isp-system-service/domain" "isp-system-service/entity" + + "github.com/pkg/errors" ) type Domain struct { diff --git a/tests/access_list_test.go b/tests/access_list_test.go new file mode 100644 index 0000000..71422b8 --- /dev/null +++ b/tests/access_list_test.go @@ -0,0 +1,231 @@ +package tests_test + +import ( + "testing" + + "github.com/txix-open/isp-kit/dbx" + + "isp-system-service/assembly" + "isp-system-service/conf" + "isp-system-service/domain" + "isp-system-service/entity" + "isp-system-service/repository" + + "github.com/stretchr/testify/suite" + "github.com/txix-open/isp-kit/grpc/client" + "github.com/txix-open/isp-kit/test" + "github.com/txix-open/isp-kit/test/dbt" + "github.com/txix-open/isp-kit/test/fake" + "github.com/txix-open/isp-kit/test/grpct" +) + +func TestAccessListSuite(t *testing.T) { + t.Parallel() + suite.Run(t, &AccessListSuite{}) +} + +type AccessListSuite struct { + suite.Suite + test *test.Test + testDb *dbt.TestDb + api *client.Client + accessListRepo repository.AccessList + appId int +} + +func (s *AccessListSuite) SetupTest() { + s.test, _ = test.New(s.T()) + + s.testDb = dbt.New(s.test, dbx.WithMigrationRunner("../migrations", s.test.Logger())) + + locator := assembly.NewLocator(s.testDb, s.test.Logger()) + config := locator.Config(conf.Remote{}) + _, s.api = grpct.TestServer(s.test, config.Handler) + s.accessListRepo = repository.NewAccessList(s.testDb) + + createdDomain, err := repository.NewDomain(s.testDb).CreateDomain( + s.T().Context(), + fake.It[string](), + fake.It[string](), + 1, + ) + s.Require().NoError(err) + + appGroup, err := repository.NewAppGroup(s.testDb).CreateAppGroup( + s.T().Context(), + fake.It[string](), + fake.It[string](), + createdDomain.Id, + ) + s.Require().NoError(err) + + s.appId = fake.It[int]() + + _, err = repository.NewApplication(s.testDb).CreateApplication( + s.T().Context(), + s.appId, + fake.It[string](), + fake.It[string](), + appGroup.Id, + domain.ApplicationSystemType, + ) + s.Require().NoError(err) +} + +func (s *AccessListSuite) TestGetById_HappyPath() { + expectedAccessList := []entity.AccessList{ + { + AppId: s.appId, + Method: fake.It[string](), + Value: false, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + } + + err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), expectedAccessList) + s.Require().NoError(err) + + req := domain.Identity{ + Id: s.appId, + } + var accessList []domain.MethodInfo + err = s.api.Invoke("system/access_list/get_by_id"). + JsonRequestBody(&req). + JsonResponseBody(&accessList). + Do(s.T().Context()) + s.Require().NoError(err) + s.Require().Len(accessList, len(expectedAccessList)) + + actualAccessList := s.convertAccessList(accessList) + s.Require().ElementsMatch(expectedAccessList, actualAccessList) +} + +func (s *AccessListSuite) TestSetOne_HappyPath() { + expectedAccessList := []entity.AccessList{ + { + AppId: s.appId, + Method: fake.It[string](), + Value: false, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + } + + err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), expectedAccessList) + s.Require().NoError(err) + + req := domain.AccessListSetOneRequest{ + AppId: s.appId, + Method: expectedAccessList[0].Method, + Value: true, + } + err = s.api.Invoke("system/access_list/set_one"). + JsonRequestBody(&req). + Do(s.T().Context()) + s.Require().NoError(err) + + actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId) + s.Require().NoError(err) + + for i := range expectedAccessList { + expectedAccessList[i].Value = true + } + s.Require().ElementsMatch(expectedAccessList, actualAccessList) +} + +func (s *AccessListSuite) TestSetList_HappyPath() { + req := domain.AccessListSetListRequest{ + AppId: s.appId, + Methods: []domain.MethodInfo{ + { + Method: fake.It[string](), + Value: true, + }, + { + Method: fake.It[string](), + Value: true, + }, + }, + } + + err := s.api.Invoke("system/access_list/set_list"). + JsonRequestBody(&req). + Do(s.T().Context()) + s.Require().NoError(err) + + actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId) + s.Require().NoError(err) + s.Require().Len(actualAccessList, len(req.Methods)) + + expectedAccessList := s.convertAccessList(req.Methods) + s.Require().ElementsMatch(expectedAccessList, actualAccessList) +} + +func (s *AccessListSuite) TestDeleteList_HappyPath() { + accessList := []entity.AccessList{ + { + AppId: s.appId, + Method: fake.It[string](), + Value: false, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + { + AppId: s.appId, + Method: fake.It[string](), + Value: true, + }, + } + + err := s.accessListRepo.InsertArrayAccessList(s.T().Context(), accessList) + s.Require().NoError(err) + + req := domain.AccessListDeleteListRequest{ + AppId: s.appId, + Methods: []string{ + accessList[0].Method, + accessList[1].Method, + }, + } + err = s.api.Invoke("system/access_list/delete_list"). + JsonRequestBody(&req). + Do(s.T().Context()) + s.Require().NoError(err) + + actualAccessList, err := s.accessListRepo.GetAccessListByAppId(s.T().Context(), s.appId) + s.Require().NoError(err) + s.Require().Len(actualAccessList, 1) + s.Require().Equal(accessList[2], actualAccessList[0]) +} + +func (s *AccessListSuite) convertAccessList(methods []domain.MethodInfo) []entity.AccessList { + converted := make([]entity.AccessList, 0, len(methods)) + for _, method := range methods { + converted = append(converted, entity.AccessList{ + AppId: s.appId, + Method: method.Method, + Value: method.Value, + }) + } + return converted +} diff --git a/tests/secure_test.go b/tests/secure_test.go index b5e51d6..bd0d8fb 100644 --- a/tests/secure_test.go +++ b/tests/secure_test.go @@ -12,7 +12,6 @@ import ( "isp-system-service/domain" "isp-system-service/entity" - "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/txix-open/isp-kit/grpc/client" "github.com/txix-open/isp-kit/test" @@ -27,14 +26,13 @@ func TestSecureSuite(t *testing.T) { type SecureSuite struct { suite.Suite - test *test.Test - require *require.Assertions - testDb *dbt.TestDb - api *client.Client + test *test.Test + testDb *dbt.TestDb + api *client.Client } func (s *SecureSuite) SetupSuite() { - s.test, s.require = test.New(s.T()) + s.test, _ = test.New(s.T()) s.testDb = dbt.New(s.test, dbx.WithMigrationRunner("../migrations", s.test.Logger())) @@ -66,8 +64,8 @@ func (s *SecureSuite) TestAuthenticate_Success() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthenticateResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthenticateResponse{ Authenticated: true, ErrorReason: "", AuthData: &domain.AuthData{ @@ -87,8 +85,8 @@ func (s *SecureSuite) TestAuthenticate_NotFound() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthenticateResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthenticateResponse{ Authenticated: false, ErrorReason: domain.ErrTokenNotFound.Error(), AuthData: nil, @@ -107,8 +105,8 @@ func (s *SecureSuite) TestAuthenticate_NotExpired() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthenticateResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthenticateResponse{ Authenticated: true, ErrorReason: "", AuthData: &domain.AuthData{ @@ -132,8 +130,8 @@ func (s *SecureSuite) TestAuthenticate_Expired() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthenticateResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthenticateResponse{ Authenticated: false, ErrorReason: domain.ErrTokenExpired.Error(), AuthData: nil, @@ -155,8 +153,8 @@ func (s *SecureSuite) TestAuthorize_Success_True() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthorizeResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthorizeResponse{ Authorized: true, }, result) } @@ -176,8 +174,8 @@ func (s *SecureSuite) TestAuthorize_Success_False() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthorizeResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthorizeResponse{ Authorized: false, }, result) } @@ -191,8 +189,8 @@ func (s *SecureSuite) TestAuthorize_NotFound() { }). JsonResponseBody(&result). Do(context.Background()) - s.require.NoError(err) - s.require.Equal(domain.AuthorizeResponse{ + s.Require().NoError(err) + s.Require().Equal(domain.AuthorizeResponse{ Authorized: false, }, result) }