package giam

import (
	"context"
	"testing"

	. "github.com/onsi/gomega"
	"google.golang.org/api/iam/v1"
)

func TestServiceWrap(t *testing.T) {
	g := NewGomegaWithT(t)
	s := iam.ProjectsServiceAccountsService{}
	cli := ProjectsServiceAccountsServiceWrap{
		ProjectsServiceAccountsService: &s,
	}
	//create
	g.Expect(cli.Create(context.Background(), "test-1", &iam.CreateServiceAccountRequest{})).Should(Equal(s.Create("test-1", &iam.CreateServiceAccountRequest{}).Context(context.Background())))
	//delete
	g.Expect(cli.Delete(context.Background(), "test-1")).Should(Equal(s.Delete("test-1").Context(context.Background())))
	//get
	g.Expect(cli.Get(context.Background(), "test-1")).Should(Equal(s.Get("test-1").Context(context.Background())))
	//getiam
	g.Expect(cli.GetIamPolicy(context.Background(), "test-1")).Should(Equal(s.GetIamPolicy("test-1").Context(context.Background())))
	//setiam
	g.Expect(cli.SetIamPolicy(context.Background(), "test-1", &iam.SetIamPolicyRequest{})).Should(Equal(s.SetIamPolicy("test-1", &iam.SetIamPolicyRequest{}).Context(context.Background())))
}
