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

Method TestCreateOrganization

database/sql/organizations_test.go:189–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187}
188
189func (s *OrgTestSuite) TestCreateOrganization() {
190 // call tested function
191 org, err := s.Store.CreateOrganization(
192 s.adminCtx,
193 s.Fixtures.CreateOrgParams.Name,
194 s.testCreds,
195 s.Fixtures.CreateOrgParams.WebhookSecret,
196 params.PoolBalancerTypeRoundRobin,
197 false,
198 )
199
200 // assertions
201 s.Require().Nil(err)
202 storeOrg, err := s.Store.GetOrganizationByID(s.adminCtx, org.ID)
203 if err != nil {
204 s.FailNow(fmt.Sprintf("failed to get organization by id: %v", err))
205 }
206 s.Require().Equal(storeOrg.Name, org.Name)
207 s.Require().Equal(storeOrg.Credentials.Name, org.Credentials.Name)
208 s.Require().Equal(storeOrg.WebhookSecret, org.WebhookSecret)
209
210 entity, err := org.GetEntity()
211 s.Require().Nil(err)
212 s.Require().Equal(entity.EntityType, params.ForgeEntityTypeOrganization)
213 s.Require().Equal(entity.ID, org.ID)
214
215 forgeType, err := entity.GetForgeType()
216 s.Require().Nil(err)
217 s.Require().Equal(forgeType, params.GithubEndpointType)
218}
219
220func (s *OrgTestSuite) TestCreateOrgForGitea() {
221 // call tested function

Callers

nothing calls this directly

Calls 4

GetForgeTypeMethod · 0.80
CreateOrganizationMethod · 0.65
GetOrganizationByIDMethod · 0.65
GetEntityMethod · 0.65

Tested by

no test coverage detected