From 9c4f15e57b42b93f6c8ff6677e4cc68d516a226a Mon Sep 17 00:00:00 2001 From: Bob Aman Date: Thu, 17 Jan 2019 18:31:42 -0800 Subject: [PATCH] Update mock file to match rename of graph service struct --- internal/auth/providers/azure_graph_mock.go | 12 ------------ internal/auth/providers/azure_test.go | 4 ++-- internal/auth/providers/ms_graph_mock.go | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 internal/auth/providers/azure_graph_mock.go create mode 100644 internal/auth/providers/ms_graph_mock.go diff --git a/internal/auth/providers/azure_graph_mock.go b/internal/auth/providers/azure_graph_mock.go deleted file mode 100644 index 044ce01f..00000000 --- a/internal/auth/providers/azure_graph_mock.go +++ /dev/null @@ -1,12 +0,0 @@ -package providers - -// MockAzureGraphService is an implementation of GraphService to be used for testing -type MockAzureGraphService struct { - Groups []string - GroupsError error -} - -// GetGroups mocks the GetGroups function -func (ms *MockAzureGraphService) GetGroups(string) ([]string, error) { - return ms.Groups, ms.GroupsError -} diff --git a/internal/auth/providers/azure_test.go b/internal/auth/providers/azure_test.go index 8716b09d..b839ba74 100644 --- a/internal/auth/providers/azure_test.go +++ b/internal/auth/providers/azure_test.go @@ -376,7 +376,7 @@ func TestAzureV2ProviderRedeem(t *testing.T) { testutil.Equal(t, nil, err) // graph service mock has to be set after p.Configure - p.GraphService = &MockAzureGraphService{} + p.GraphService = &MockMSGraphService{} session, err := p.Redeem("http://redirect/", "code1234") if tc.expectedError && err == nil { @@ -540,7 +540,7 @@ func TestAzureV2ValidateGroupMembers(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { p := newAzureV2Provider(nil) - p.GraphService = &MockAzureGraphService{ + p.GraphService = &MockMSGraphService{ Groups: tc.mockedGroups, GroupsError: tc.mockedError, } diff --git a/internal/auth/providers/ms_graph_mock.go b/internal/auth/providers/ms_graph_mock.go new file mode 100644 index 00000000..e841b842 --- /dev/null +++ b/internal/auth/providers/ms_graph_mock.go @@ -0,0 +1,12 @@ +package providers + +// MockMSGraphService is an implementation of GraphService to be used for testing +type MockMSGraphService struct { + Groups []string + GroupsError error +} + +// GetGroups mocks the GetGroups function +func (ms *MockMSGraphService) GetGroups(string) ([]string, error) { + return ms.Groups, ms.GroupsError +}