MCPcopy Create free account
hub / github.com/cloudbase/garm / TestCreateRepository

Method TestCreateRepository

database/sql/repositories_test.go:206–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

204}
205
206func (s *RepoTestSuite) TestCreateRepository() {
207 // call tested function
208 repo, err := s.Store.CreateRepository(
209 s.adminCtx,
210 s.Fixtures.CreateRepoParams.Owner,
211 s.Fixtures.CreateRepoParams.Name,
212 s.testCreds,
213 s.Fixtures.CreateRepoParams.WebhookSecret,
214 params.PoolBalancerTypeRoundRobin,
215 false,
216 )
217
218 // assertions
219 s.Require().Nil(err)
220 storeRepo, err := s.Store.GetRepositoryByID(s.adminCtx, repo.ID)
221 if err != nil {
222 s.FailNow(fmt.Sprintf("failed to get repository by id: %v", err))
223 }
224 s.Require().Equal(storeRepo.Owner, repo.Owner)
225 s.Require().Equal(storeRepo.Name, repo.Name)
226 s.Require().Equal(storeRepo.Credentials.Name, repo.Credentials.Name)
227 s.Require().Equal(storeRepo.WebhookSecret, repo.WebhookSecret)
228
229 entity, err := repo.GetEntity()
230 s.Require().Nil(err)
231 s.Require().Equal(s.Fixtures.CreateRepoParams.Owner, entity.Owner)
232 s.Require().Equal(entity.EntityType, params.ForgeEntityTypeRepository)
233
234 forgeType, err := entity.GetForgeType()
235 s.Require().Nil(err)
236 s.Require().Equal(forgeType, params.GithubEndpointType)
237}
238
239func (s *RepoTestSuite) TestCreateRepositoryGitea() {
240 // call tested function

Callers

nothing calls this directly

Calls 4

GetForgeTypeMethod · 0.80
CreateRepositoryMethod · 0.65
GetRepositoryByIDMethod · 0.65
GetEntityMethod · 0.65

Tested by

no test coverage detected