go-git-providers icon indicating copy to clipboard operation
go-git-providers copied to clipboard

Add a test case for setting the default branch when creating a repo

Open dinosk opened this issue 4 years ago • 0 comments

Stemming from comment https://github.com/fluxcd/go-git-providers/pull/61#issuecomment-702702062

To ensure that setting the default branch of a repo at creation time is functional, it should be covered in a test case in the integration tests. Creating a github repo belonging to a user with the default branch set to deploy for example, can be done with:

repo, err := c.OrgRepositories().Create(ctx, repoRef, gitprovider.RepositoryInfo{
			Description: gitprovider.StringVar("foo"),
			DefaultBranch: gitprovider.StringVar("deploy")
		}, &gitprovider.RepositoryCreateOptions{
			AutoInit:        gitprovider.BoolVar(true),
			LicenseTemplate: gitprovider.LicenseTemplateVar(gitprovider.LicenseTemplateApache2),
		})

dinosk avatar Oct 02 '20 12:10 dinosk