Skip to content

Commit

Permalink
MG-2143 - Generate mocks with mockery for Invitations service (absmac…
Browse files Browse the repository at this point in the history
…h#2144)

Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene authored and JeffMboya committed Apr 10, 2024
1 parent 30d668d commit 47097f1
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 116 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
go-version: 1.21.x
cache-dependency-path: "go.sum"

- name: Check for changes in go.mod
run: |
go mod tidy
Expand Down Expand Up @@ -60,6 +60,7 @@ jobs:
- "pkg/groups/groups.go"
- "bootstrap/service.go"
- "bootstrap/configs.go"
- "invitations/invitations.go"
- name: Set up protoc
if: steps.changes.outputs.proto == 'true'
Expand Down Expand Up @@ -125,6 +126,8 @@ jobs:
mv ./pkg/groups/mocks/service.go ./pkg/groups/mocks/service.go.tmp
mv ./bootstrap/mocks/service.go ./bootstrap/mocks/service.go.tmp
mv ./bootstrap/mocks/configs.go ./bootstrap/mocks/configs.go.tmp
mv ./invitations/mocks/service.go ./invitations/mocks/service.go.tmp
mv ./invitations/mocks/repository.go ./invitations/mocks/repository.go.tmp
make mocks
Expand Down Expand Up @@ -159,3 +162,5 @@ jobs:
check_mock_changes ./pkg/groups/mocks/service.go "Groups Service ./pkg/groups/mocks/service.go"
check_mock_changes ./bootstrap/mocks/service.go "Bootstrap Service ./bootstrap/mocks/service.go"
check_mock_changes ./bootstrap/mocks/configs.go "Bootstrap Repository ./bootstrap/mocks/configs.go"
check_mock_changes ./invitations/mocks/service.go "Invitations Service ./invitations/mocks/service.go"
check_mock_changes ./invitations/mocks/repository.go "Invitations Repository ./invitations/mocks/repository.go"
3 changes: 3 additions & 0 deletions invitations/invitations.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func (page InvitationPage) MarshalJSON() ([]byte, error) {
}

// Service is an interface that defines methods for managing invitations.
//
//go:generate mockery --name Service --output=./mocks --filename service.go --quiet --note "Copyright (c) Abstract Machines"
type Service interface {
// SendInvitation sends an invitation to the given user.
// Only domain administrators and platform administrators can send invitations.
Expand Down Expand Up @@ -93,6 +95,7 @@ type Service interface {
DeleteInvitation(ctx context.Context, token, userID, domainID string) (err error)
}

//go:generate mockery --name Repository --output=./mocks --filename repository.go --quiet --note "Copyright (c) Abstract Machines"
type Repository interface {
// Create creates an invitation.
Create(ctx context.Context, invitation Invitation) (err error)
Expand Down
80 changes: 0 additions & 80 deletions invitations/mocks/invitations.go

This file was deleted.

159 changes: 159 additions & 0 deletions invitations/mocks/repository.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 47097f1

Please sign in to comment.