Skip to content

Commit

Permalink
removing search from api
Browse files Browse the repository at this point in the history
  • Loading branch information
pputman-clabs committed Mar 6, 2023
1 parent 2a4ff6d commit 5262925
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
25 changes: 14 additions & 11 deletions mockgcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ type PolicyCallItf interface {
}

// SearchCallItf interface will match for Do() so we can match
type SearchCallItf interface {
Do(opts ...googleapi.CallOption) (ResponseItf, error)
}
//type SearchCallItf interface {
// Do(opts ...googleapi.CallOption) (ResponseItf, error)
//}

type ResponseItf interface {
}
//type ResponseItf interface {
//
//}

// Wrapper methods for Google Clouds API

Expand All @@ -69,9 +69,11 @@ func (client *GCPClient) ProjectGetIamPolicy(resource string, getiampolicyreques
}

// FoldersSearch Searches for folders by Name to get the ID
/*
func (client *GCPClient) FoldersSearch() *FoldersSearchCall {
return client.Service.Folders.Search()
}
*/

// FolderSetIamPolicy is a wrapper for the Folders.SetIamPolicy method so we can create and interface to match
// our mock client to the GCP client
Expand All @@ -84,12 +86,12 @@ func (client *GCPClient) FolderSetIamPolicy(resource string, setiampolicyrequest
func (client *GCPClient) FolderGetIamPolicy(resource string, getiampolicyrequest *cloudresourcemanager.GetIamPolicyRequest) PolicyCallItf {
return client.Service.Folders.GetIamPolicy(resource, getiampolicyrequest)
}

/*
// OrganizationsSearch Searches for folders by Name to get the ID
func (client *GCPClient) OrganizationsSearch() *OrganizationsSearchCall {
return client.Service.Organizations.Search()
}

*/
// OrganizationSetIamPolicy is a wrapper for the Organizations.SetIamPolicy method so we can create and interface to match
// our mock client to the GCP client
func (client *GCPClient) OrganizationSetIamPolicy(resource string, setiampolicyrequest *cloudresourcemanager.SetIamPolicyRequest) PolicyCallItf {
Expand Down Expand Up @@ -221,7 +223,7 @@ func (r *OrganizationsService) SetIamPolicy(resource string, setiampolicyrequest
c.Setiampolicyrequest = setiampolicyrequest
return c
}

/*
// OrganizationsSearchCall contains the query information for a organization search
type OrganizationsSearchCall struct {
query string
Expand Down Expand Up @@ -260,6 +262,7 @@ func (call *OrganizationsSearchCall) Do(opts ...googleapi.CallOption) (*SearchOr
}
return response, nil
}
*/

// OrganizationsGetIamPolicyCall is a structure that is returned by Organizations.GetIamPolicy which contains the Request
// to get a policy. Then we call Do() on it to actually return the policy
Expand Down Expand Up @@ -541,7 +544,7 @@ func (r *FoldersService) SetIamPolicy(resource string, setiampolicyrequest *clou
c.Setiampolicyrequest = setiampolicyrequest
return c
}

/*
// FoldersSearchCall contains the query information for a folder search
type FoldersSearchCall struct {
query string
Expand Down Expand Up @@ -580,7 +583,7 @@ func (call *FoldersSearchCall) Do(opts ...googleapi.CallOption) (*SearchFoldersR
}
return response, nil
}

*/
// FoldersGetIamPolicyCall is a structure that is returned by Folders.GetIamPolicy which contains the Request
// to get a policy. Then we call Do() on it to actually return the policy
type FoldersGetIamPolicyCall struct {
Expand Down
8 changes: 4 additions & 4 deletions mockgcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestOrganizationsService_FindPolicy(t *testing.T) {
t.Errorf("got %v want %v", got, want)
}
}

/*
func TestOrganization_OrganizationsSearchCall_Do(t *testing.T) {
t.Run("should return Organization with proper ID", func(t *testing.T) {
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestProject_ProjectsSearchCall_Do(t *testing.T) {
}
})
}

*/
func TestProject_GetIamPolicy_Do(t *testing.T) {
t.Run("should return err if project doesn't exist", func(t *testing.T) {
projectID := "projects/TestProject"
Expand Down Expand Up @@ -243,7 +243,7 @@ func TestProject_SetIamPolicy_Do(t *testing.T) {
}
})
}

/*
func TestFolder_FoldersSearchCall_Do(t *testing.T) {
t.Run("should return Folder with proper ID", func(t *testing.T) {
Expand Down Expand Up @@ -275,7 +275,7 @@ func TestFolder_FoldersSearchCall_Do(t *testing.T) {
}
})
}

*/
func TestFolder_GetIamPolicy_Do(t *testing.T) {
t.Run("should err if folder doesn't exist", func(t *testing.T) {
folderID := "folders/TestFolder"
Expand Down

0 comments on commit 5262925

Please sign in to comment.