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

Method TestCreateRepositoryGitea

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

Source from the content-addressed store, hash-verified

237}
238
239func (s *RepoTestSuite) TestCreateRepositoryGitea() {
240 // call tested function
241 repo, err := s.Store.CreateRepository(
242 s.adminCtx,
243 s.Fixtures.CreateRepoParams.Owner,
244 s.Fixtures.CreateRepoParams.Name,
245 s.testCredsGitea,
246 s.Fixtures.CreateRepoParams.WebhookSecret,
247 params.PoolBalancerTypeRoundRobin,
248 false,
249 )
250
251 // assertions
252 s.Require().Nil(err)
253 storeRepo, err := s.Store.GetRepositoryByID(s.adminCtx, repo.ID)
254 if err != nil {
255 s.FailNow(fmt.Sprintf("failed to get repository by id: %v", err))
256 }
257 s.Require().Equal(storeRepo.Owner, repo.Owner)
258 s.Require().Equal(storeRepo.Name, repo.Name)
259 s.Require().Equal(storeRepo.Credentials.Name, repo.Credentials.Name)
260 s.Require().Equal(storeRepo.WebhookSecret, repo.WebhookSecret)
261
262 entity, err := repo.GetEntity()
263 s.Require().Nil(err)
264 s.Require().Equal(repo.ID, entity.ID)
265 s.Require().Equal(entity.EntityType, params.ForgeEntityTypeRepository)
266
267 forgeType, err := entity.GetForgeType()
268 s.Require().Nil(err)
269 s.Require().Equal(forgeType, params.GiteaEndpointType)
270}
271
272func (s *RepoTestSuite) TestCreateRepositoryInvalidForgeType() {
273 // 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