Skip to content

Commit 81f05aa

Browse files
committed
more
1 parent ab47902 commit 81f05aa

File tree

102 files changed

+2829
-1603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2829
-1603
lines changed

internal/cli/accesslists/delete.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ import (
2727
"github.com/spf13/cobra"
2828
)
2929

30+
//go:generate mockgen -typed -destination=delete_mock_test.go -package=accesslists . ProjectIPAccessListDeleter
31+
32+
type ProjectIPAccessListDeleter interface {
33+
DeleteProjectIPAccessList(string, string) error
34+
}
35+
3036
type DeleteOpts struct {
3137
cli.ProjectOpts
3238
*cli.DeleteOpts
33-
store store.ProjectIPAccessListDeleter
39+
store ProjectIPAccessListDeleter
3440
}
3541

3642
func (opts *DeleteOpts) initStore(ctx context.Context) func() error {

internal/cli/accesslists/delete_mock_test.go

+78
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/accesslists/delete_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ import (
2020
"testing"
2121

2222
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
23-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2423
"go.uber.org/mock/gomock"
2524
)
2625

2726
func TestWhitelistDelete_Run(t *testing.T) {
2827
ctrl := gomock.NewController(t)
29-
mockStore := mocks.NewMockProjectIPAccessListDeleter(ctrl)
28+
mockStore := NewMockProjectIPAccessListDeleter(ctrl)
3029

3130
deleteOpts := &DeleteOpts{
3231
DeleteOpts: &cli.DeleteOpts{

internal/cli/accesslists/describe.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ import (
2424
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store"
2525
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
2626
"github.com/spf13/cobra"
27+
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
2728
)
2829

2930
const describeTemplate = `CIDR BLOCK SECURITY GROUP
3031
{{.CidrBlock}} {{if .AwsSecurityGroup}}{{.AwsSecurityGroup}} {{else}}N/A{{end}}
3132
`
3233

34+
//go:generate mockgen -typed -destination=describe_mock_test.go -package=accesslists . ProjectIPAccessListDescriber
35+
36+
type ProjectIPAccessListDescriber interface {
37+
IPAccessList(string, string) (*atlasv2.NetworkPermissionEntry, error)
38+
}
39+
3340
type DescribeOpts struct {
3441
cli.ProjectOpts
3542
cli.OutputOpts
3643
name string
37-
store store.ProjectIPAccessListDescriber
44+
store ProjectIPAccessListDescriber
3845
}
3946

4047
func (opts *DescribeOpts) initStore(ctx context.Context) func() error {

internal/cli/accesslists/describe_mock_test.go

+80
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/accesslists/describe_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"time"
2323

2424
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
25-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2625
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer"
2726
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test"
2827
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
@@ -31,7 +30,7 @@ import (
3130

3231
func TestWhitelistDescribe_Run(t *testing.T) {
3332
ctrl := gomock.NewController(t)
34-
mockStore := mocks.NewMockProjectIPAccessListDescriber(ctrl)
33+
mockStore := NewMockProjectIPAccessListDescriber(ctrl)
3534

3635
expected := &atlasv2.NetworkPermissionEntry{
3736
AwsSecurityGroup: pointer.Get("test"),

internal/cli/accesslists/list.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ import (
2424
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store"
2525
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
2626
"github.com/spf13/cobra"
27+
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
2728
)
2829

2930
const listTemplate = `CIDR BLOCK AWS SECURITY GROUP{{range valueOrEmptySlice .Results}}
3031
{{.CidrBlock}} {{if .AwsSecurityGroup}}{{.AwsSecurityGroup}} {{else}}N/A{{end}}{{end}}
3132
`
3233

34+
//go:generate mockgen -typed -destination=list_mock_test.go -package=accesslists . ProjectIPAccessListLister
35+
36+
type ProjectIPAccessListLister interface {
37+
ProjectIPAccessLists(string, *store.ListOptions) (*atlasv2.PaginatedNetworkAccess, error)
38+
}
39+
3340
type ListOpts struct {
3441
cli.ProjectOpts
3542
cli.OutputOpts
3643
cli.ListOpts
37-
store store.ProjectIPAccessListLister
44+
store ProjectIPAccessListLister
3845
}
3946

4047
func (opts *ListOpts) initStore(ctx context.Context) func() error {

internal/cli/accesslists/list_mock_test.go

+81
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/accesslists/list_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"time"
2323

2424
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
25-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2625
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer"
2726
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test"
2827
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
@@ -31,7 +30,7 @@ import (
3130

3231
func TestWhitelistList_Run(t *testing.T) {
3332
ctrl := gomock.NewController(t)
34-
mockStore := mocks.NewMockProjectIPAccessListLister(ctrl)
33+
mockStore := NewMockProjectIPAccessListLister(ctrl)
3534

3635
expected := &atlasv2.PaginatedNetworkAccess{
3736
Links: &[]atlasv2.Link{

internal/cli/auth/login.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ import (
3434
"go.mongodb.org/atlas/auth"
3535
)
3636

37-
//go:generate mockgen -destination=../../mocks/mock_login.go -package=mocks github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/auth LoginConfig
37+
//go:generate mockgen -typed -destination=login_mock_test.go -package=auth . LoginConfig
38+
39+
type SetSaver interface {
40+
Set(string, any)
41+
Save() error
42+
SetGlobal(string, any)
43+
}
3844

3945
type LoginConfig interface {
40-
config.SetSaver
46+
SetSaver
4147
AccessTokenSubject() (string, error)
4248
OrgID() string
4349
ProjectID() string

0 commit comments

Comments
 (0)