Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
KM498 🐛 Move functions to GithubService (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvark authored Feb 18, 2022
1 parent 300cffb commit e5307ea
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/release_notes/0.0.92.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Bugfixes

KM498 🐛 Move functions to GithubService (#917)

## Changes

## Other
Expand Down
5 changes: 0 additions & 5 deletions pkg/client/github_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ type DeleteGithubDeployKeyOpts struct {
type GithubService interface {
CreateGithubRepository(ctx context.Context, opts CreateGithubRepositoryOpts) (*GithubRepository, error)
DeleteGithubRepository(ctx context.Context, opts DeleteGithubRepositoryOpts) error
ListReleases(owner, repo string) ([]*github.RepositoryRelease, error)
}

// GithubAPI invokes the Github API
type GithubAPI interface {
CreateRepositoryDeployKey(opts CreateGithubDeployKeyOpts) (*GithubDeployKey, error)
DeleteRepositoryDeployKey(opts DeleteGithubDeployKeyOpts) error
ListReleases(owner, repo string) ([]*github.RepositoryRelease, error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ func (m mockGithubService) ListReleases(_, _ string) ([]*github.RepositoryReleas
return nil, nil
}

func (m mockGithubService) CreateRepositoryDeployKey(_ client.CreateGithubDeployKeyOpts) (*client.GithubDeployKey, error) {
return nil, nil
}

func (m mockGithubService) DeleteRepositoryDeployKey(_ client.DeleteGithubDeployKeyOpts) error {
return nil
}

type mockArgoCDState struct {
exists bool
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/upgrade/testhelper_github_service_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ type githubServiceMock struct {
releases []*github.RepositoryRelease
}

func (g githubServiceMock) CreateRepositoryDeployKey(_ client.CreateGithubDeployKeyOpts) (*client.GithubDeployKey, error) {
panic("not needed by mock")
}

func (g githubServiceMock) DeleteRepositoryDeployKey(_ client.DeleteGithubDeployKeyOpts) error {
panic("not needed by mock")
}

func (g githubServiceMock) CreateGithubRepository(context.Context, client.CreateGithubRepositoryOpts) (*client.GithubRepository, error) {
panic("not needed by mock")
}
Expand Down

0 comments on commit e5307ea

Please sign in to comment.