本文整理汇总了Golang中github.com/almighty/almighty-core/gormapplication.NewGormDB函数的典型用法代码示例。如果您正苦于以下问题:Golang NewGormDB函数的具体用法?Golang NewGormDB怎么用?Golang NewGormDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewGormDB函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetupSuite
// The SetupSuite method will run before the tests in the suite are run.
// It sets up a database connection for all the tests in this suite without polluting global space.
func (s *workItemLinkTypeSuite) SetupSuite() {
var err error
if err = configuration.Setup(""); err != nil {
panic(fmt.Errorf("Failed to setup the configuration: %s", err.Error()))
}
s.db, err = gorm.Open("postgres", configuration.GetPostgresConfigString())
if err != nil {
panic("Failed to connect database: " + err.Error())
}
// Make sure the database is populated with the correct types (e.g. bug etc.)
if err := models.Transactional(DB, func(tx *gorm.DB) error {
return migration.PopulateCommonTypes(context.Background(), tx, workitem.NewWorkItemTypeRepository(tx))
}); err != nil {
panic(err.Error())
}
svc := goa.New("workItemLinkTypeSuite-Service")
require.NotNil(s.T(), svc)
s.linkTypeCtrl = NewWorkItemLinkTypeController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.linkTypeCtrl)
s.linkCatCtrl = NewWorkItemLinkCategoryController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.linkCatCtrl)
// s.typeCtrl = NewWorkitemtypeController(svc, gormapplication.NewGormDB(DB))
// require.NotNil(s.T(), s.typeCtrl)
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:31,代码来源:work-item-link-type-blackbox_test.go
示例2: TestTrackerQueryListItemsNotNil
// This test ensures that List does not return NIL items.
func TestTrackerQueryListItemsNotNil(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
controller := TrackerController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
payload := app.CreateTrackerAlternatePayload{
URL: "http://api.github.com",
Type: "github",
}
_, result := test.CreateTrackerCreated(t, nil, nil, &controller, &payload)
t.Log(result.ID)
tqController := TrackerqueryController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
tqpayload := app.CreateTrackerQueryAlternatePayload{
Query: "is:open is:issue user:arquillian author:aslakknutsen",
Schedule: "15 * * * * *",
TrackerID: result.ID,
}
test.CreateTrackerqueryCreated(t, nil, nil, &tqController, &tqpayload)
test.CreateTrackerqueryCreated(t, nil, nil, &tqController, &tqpayload)
_, list := test.ListTrackerqueryOK(t, nil, nil, &tqController)
for _, tq := range list {
if tq == nil {
t.Error("Returned Tracker Query found nil")
}
}
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:28,代码来源:trackerquery_test.go
示例3: TestGetTrackerQuery
func TestGetTrackerQuery(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
controller := TrackerController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
payload := app.CreateTrackerAlternatePayload{
URL: "http://api.github.com",
Type: "github",
}
_, result := test.CreateTrackerCreated(t, nil, nil, &controller, &payload)
tqController := TrackerqueryController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
tqpayload := app.CreateTrackerQueryAlternatePayload{
Query: "is:open is:issue user:arquillian author:aslakknutsen",
Schedule: "15 * * * * *",
TrackerID: result.ID,
}
fmt.Printf("tq payload %#v", tqpayload)
_, tqresult := test.CreateTrackerqueryCreated(t, nil, nil, &tqController, &tqpayload)
test.ShowTrackerqueryOK(t, nil, nil, &tqController, tqresult.ID)
_, tqr := test.ShowTrackerqueryOK(t, nil, nil, &tqController, tqresult.ID)
if tqr == nil {
t.Fatalf("Tracker Query '%s' not present", tqresult.ID)
}
if tqr.ID != tqresult.ID {
t.Errorf("Id should be %s, but is %s", tqresult.ID, tqr.ID)
}
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:29,代码来源:trackerquery_test.go
示例4: SetupTest
// The SetupTest method will be run before every test in the suite.
func (s *workItemTypeSuite) SetupTest() {
svc := goa.New("workItemTypeSuite-Service")
assert.NotNil(s.T(), svc)
s.typeCtrl = NewWorkitemtypeController(svc, gormapplication.NewGormDB(s.DB))
assert.NotNil(s.T(), s.typeCtrl)
s.linkTypeCtrl = NewWorkItemLinkTypeController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.linkTypeCtrl)
s.linkCatCtrl = NewWorkItemLinkCategoryController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.linkCatCtrl)
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:11,代码来源:workitemtype_blackbox_test.go
示例5: SetupSuite
// The SetupSuite method will run before the tests in the suite are run.
// It sets up a database connection for all the tests in this suite without polluting global space.
func (s *workItemLinkSuite) SetupSuite() {
var err error
if err = configuration.Setup(""); err != nil {
panic(fmt.Errorf("Failed to setup the configuration: %s", err.Error()))
}
s.db, err = gorm.Open("postgres", configuration.GetPostgresConfigString())
if err != nil {
panic("Failed to connect database: " + err.Error())
}
// Make sure the database is populated with the correct types (e.g. bug etc.)
if err := models.Transactional(DB, func(tx *gorm.DB) error {
return migration.PopulateCommonTypes(context.Background(), tx, workitem.NewWorkItemTypeRepository(tx))
}); err != nil {
panic(err.Error())
}
require.Nil(s.T(), err)
priv, err := almtoken.ParsePrivateKey([]byte(almtoken.RSAPrivateKey))
require.Nil(s.T(), err)
svc := goa.New("TestWorkItemLinkType-Service")
require.NotNil(s.T(), svc)
s.workItemLinkTypeCtrl = NewWorkItemLinkTypeController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.workItemLinkTypeCtrl)
svc = goa.New("TestWorkItemLinkCategory-Service")
require.NotNil(s.T(), svc)
s.workItemLinkCategoryCtrl = NewWorkItemLinkCategoryController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.workItemLinkCategoryCtrl)
svc = goa.New("TestWorkItemLink-Service")
require.NotNil(s.T(), svc)
s.workItemLinkCtrl = NewWorkItemLinkController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.workItemLinkCtrl)
svc = goa.New("TestWorkItemRelationshipsLinks-Service")
require.NotNil(s.T(), svc)
s.workItemRelsLinksCtrl = NewWorkItemRelationshipsLinksController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.workItemRelsLinksCtrl)
s.workItemSvc = testsupport.ServiceAsUser("TestWorkItem-Service", almtoken.NewManagerWithPrivateKey(priv), testsupport.TestIdentity)
require.NotNil(s.T(), s.workItemSvc)
s.workItemCtrl = NewWorkitemController(svc, gormapplication.NewGormDB(DB))
require.NotNil(s.T(), s.workItemCtrl)
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:51,代码来源:work-item-link-blackbox_test.go
示例6: TestSpacesSearchOK
func TestSpacesSearchOK(t *testing.T) {
resource.Require(t, resource.Database)
tester := TestSearchSpaces{}
tester.db = gormapplication.NewGormDB(DB)
tester.clean = cleaner.DeleteCreatedEntities(DB)
idents, err := tester.createTestData()
if err != nil {
t.Fatal(err)
}
defer tester.cleanTestData()
tests := []okScenario{
{"With uppercase fullname query", args{offset("0"), limit(10), "TEST_AB"}, expects{totalCount(1)}},
{"With lowercase fullname query", args{offset("0"), limit(10), "TEST_AB"}, expects{totalCount(1)}},
{"With uppercase description query", args{offset("0"), limit(10), "DESCRIPTION FOR TEST_AB"}, expects{totalCount(1)}},
{"With lowercase description query", args{offset("0"), limit(10), "description for test_ab"}, expects{totalCount(1)}},
{"with special chars", args{offset("0"), limit(10), "&:\n!#%?*"}, expects{totalCount(0)}},
{"with * to list all", args{offset("0"), limit(10), "*"}, expects{totalCountAtLeast(len(idents))}},
{"with multi page", args{offset("0"), limit(10), "TEST"}, expects{hasLinks("Next")}},
{"with last page", args{offset(strconv.Itoa(len(idents) - 1)), limit(10), "TEST"}, expects{hasNoLinks("Next"), hasLinks("Prev")}},
{"with different values", args{offset("0"), limit(10), "TEST"}, expects{differentValues()}},
}
service := goa.New("TestSpacesSearch-Service")
controller := NewSearchController(service, tester.db)
for _, tt := range tests {
_, result := test.SpacesSearchOK(t, context.Background(), service, controller, tt.args.pageLimit, tt.args.pageOffset, tt.args.q)
for _, expect := range tt.expects {
expect(t, tt, result)
}
}
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:35,代码来源:search_spaces_blackbox_test.go
示例7: TestSearchPagination
func TestSearchPagination(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := getServiceAsUser()
wiRepo := workitem.NewWorkItemRepository(DB)
_, err := wiRepo.Create(
context.Background(),
workitem.SystemBug,
map[string]interface{}{
workitem.SystemTitle: "specialwordforsearch2",
workitem.SystemDescription: nil,
workitem.SystemCreator: "baijum",
workitem.SystemState: workitem.SystemStateClosed,
},
"")
require.Nil(t, err)
controller := NewSearchController(service, gormapplication.NewGormDB(DB))
q := "specialwordforsearch2"
_, sr := test.ShowSearchOK(t, nil, nil, controller, nil, nil, q)
// defaults in paging.go is 'pageSizeDefault = 20'
assert.Equal(t, "http:///api/search?page[offset]=0&page[limit]=20&q=specialwordforsearch2", *sr.Links.First)
assert.Equal(t, "http:///api/search?page[offset]=0&page[limit]=20&q=specialwordforsearch2", *sr.Links.Last)
require.NotEmpty(t, sr.Data)
r := sr.Data[0]
assert.Equal(t, "specialwordforsearch2", r.Attributes[workitem.SystemTitle])
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:30,代码来源:search_blackbox_test.go
示例8: TestUnregisteredURLWithPort
func TestUnregisteredURLWithPort(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := getServiceAsUser()
wiRepo := workitem.NewWorkItemRepository(DB)
description := "Related to http://some-other-domain:8080/different-path/154687364529310/ok issue"
expectedDescription := rendering.NewMarkupContentFromLegacy(description)
_, err := wiRepo.Create(
context.Background(),
workitem.SystemBug,
map[string]interface{}{
workitem.SystemTitle: "specialwordforsearch_new",
workitem.SystemDescription: expectedDescription,
workitem.SystemCreator: "baijum",
workitem.SystemState: workitem.SystemStateClosed,
},
"")
require.Nil(t, err)
controller := NewSearchController(service, gormapplication.NewGormDB(DB))
q := `http://some-other-domain:8080/different-path/`
_, sr := test.ShowSearchOK(t, nil, nil, controller, nil, nil, q)
require.NotEmpty(t, sr.Data)
r := sr.Data[0]
assert.Equal(t, description, r.Attributes[workitem.SystemDescription])
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:27,代码来源:search_blackbox_test.go
示例9: createControler
func createControler(t *testing.T) (*UsersController, application.DB) {
svc := goa.New("test")
app := gormapplication.NewGormDB(DB)
controller := NewUsersController(svc, app)
assert.NotNil(t, controller)
return controller, app
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:7,代码来源:users_blackbox_test.go
示例10: TestSearchURLWithoutPort
func TestSearchURLWithoutPort(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := getServiceAsUser()
wiRepo := workitem.NewWorkItemRepository(DB)
description := "This issue is related to http://localhost/detail/876394"
expectedDescription := rendering.NewMarkupContentFromLegacy(description)
_, err := wiRepo.Create(
context.Background(),
workitem.SystemBug,
map[string]interface{}{
workitem.SystemTitle: "specialwordforsearch_without_port",
workitem.SystemDescription: expectedDescription,
workitem.SystemCreator: "baijum",
workitem.SystemState: workitem.SystemStateClosed,
},
"")
require.Nil(t, err)
controller := NewSearchController(service, gormapplication.NewGormDB(DB))
q := `"http://localhost/detail/876394"`
_, sr := test.ShowSearchOK(t, nil, nil, controller, nil, nil, q)
require.NotEmpty(t, sr.Data)
r := sr.Data[0]
assert.Equal(t, description, r.Attributes[workitem.SystemDescription])
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:27,代码来源:search_blackbox_test.go
示例11: TestUnwantedCharactersRelatedToSearchLogic
func TestUnwantedCharactersRelatedToSearchLogic(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := getServiceAsUser()
wiRepo := workitem.NewWorkItemRepository(DB)
expectedDescription := rendering.NewMarkupContentFromLegacy("Related to http://example-domain:8080/different-path/ok issue")
_, err := wiRepo.Create(
context.Background(),
workitem.SystemBug,
map[string]interface{}{
workitem.SystemTitle: "specialwordforsearch_new",
workitem.SystemDescription: expectedDescription,
workitem.SystemCreator: "baijum",
workitem.SystemState: workitem.SystemStateClosed,
},
"")
require.Nil(t, err)
controller := NewSearchController(service, gormapplication.NewGormDB(DB))
// add url: in the query, that is not expected by the code hence need to make sure it gives expected result.
q := `http://url:some-random-other-domain:8080/different-path/`
_, sr := test.ShowSearchOK(t, nil, nil, controller, nil, nil, q)
require.NotNil(t, sr.Data)
assert.Empty(t, sr.Data)
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:27,代码来源:search_blackbox_test.go
示例12: TestGetTracker
func TestGetTracker(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
controller := TrackerController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
payload := app.CreateTrackerAlternatePayload{
URL: "http://issues.jboss.com",
Type: "jira",
}
_, result := test.CreateTrackerCreated(t, nil, nil, &controller, &payload)
test.ShowTrackerOK(t, nil, nil, &controller, result.ID)
_, tr := test.ShowTrackerOK(t, nil, nil, &controller, result.ID)
if tr == nil {
t.Fatalf("Tracker '%s' not present", result.ID)
}
if tr.ID != result.ID {
t.Errorf("Id should be %s, but is %s", result.ID, tr.ID)
}
payload2 := app.UpdateTrackerAlternatePayload{
URL: tr.URL,
Type: tr.Type,
}
_, updated := test.UpdateTrackerOK(t, nil, nil, &controller, tr.ID, &payload2)
if updated.ID != result.ID {
t.Errorf("Id has changed from %s to %s", result.ID, updated.ID)
}
if updated.URL != result.URL {
t.Errorf("URL has changed from %s to %s", result.URL, updated.URL)
}
if updated.Type != result.Type {
t.Errorf("Type has changed has from %s to %s", result.Type, updated.Type)
}
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:35,代码来源:tracker_test.go
示例13: TestSearch
func TestSearch(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := getServiceAsUser()
wiRepo := workitem.NewWorkItemRepository(DB)
_, err := wiRepo.Create(
context.Background(),
workitem.SystemBug,
map[string]interface{}{
workitem.SystemTitle: "specialwordforsearch",
workitem.SystemDescription: nil,
workitem.SystemCreator: "baijum",
workitem.SystemState: workitem.SystemStateClosed,
},
"")
require.Nil(t, err)
controller := NewSearchController(service, gormapplication.NewGormDB(DB))
q := "specialwordforsearch"
_, sr := test.ShowSearchOK(t, nil, nil, controller, nil, nil, q)
require.NotEmpty(t, sr.Data)
r := sr.Data[0]
assert.Equal(t, "specialwordforsearch", r.Attributes[workitem.SystemTitle])
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:25,代码来源:search_blackbox_test.go
示例14: TestUnauthorizeWorkItemLinkCUD
// This test case will check authorized access to Create/Update/Delete APIs
func (s *workItemLinkSuite) TestUnauthorizeWorkItemLinkCUD() {
UnauthorizeCreateUpdateDeleteTest(s.T(), getWorkItemLinkTestData, func() *goa.Service {
return goa.New("TestUnauthorizedCreateWorkItemLink-Service")
}, func(service *goa.Service) error {
controller := NewWorkItemLinkController(service, gormapplication.NewGormDB(DB))
app.MountWorkItemLinkController(service, controller)
return nil
})
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:10,代码来源:work-item-link-blackbox_test.go
示例15: TestUnauthorizeWorkItemTypeCreate
// This test case will check authorized access to Create/Update/Delete APIs
func TestUnauthorizeWorkItemTypeCreate(t *testing.T) {
UnauthorizeCreateUpdateDeleteTest(t, getWorkItemTypeTestData, func() *goa.Service {
return goa.New("TestUnauthorizedCreateWIT-Service")
}, func(service *goa.Service) error {
controller := NewWorkitemtypeController(service, gormapplication.NewGormDB(DB))
app.MountWorkitemtypeController(service, controller)
return nil
})
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:10,代码来源:workitemtype_blackbox_test.go
示例16: TestUnauthorizeTrackerCUD
// This test case will check authorized access to Create/Update/Delete APIs
func TestUnauthorizeTrackerCUD(t *testing.T) {
UnauthorizeCreateUpdateDeleteTest(t, getTrackerTestData, func() *goa.Service {
return goa.New("TestUnauthorizedTracker-Service")
}, func(service *goa.Service) error {
controller := NewTrackerController(service, gormapplication.NewGormDB(DB), RwiScheduler)
app.MountTrackerController(service, controller)
return nil
})
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:10,代码来源:tracker_blackbox_test.go
示例17: TestUnauthorizeWorkItemRelationshipsLinksCUD
func (s *workItemLinkSuite) TestUnauthorizeWorkItemRelationshipsLinksCUD() {
wiID := strconv.FormatUint(s.bug1ID, 10)
UnauthorizeCreateUpdateDeleteTest(s.T(), getWorkItemRelationshipLinksTestData(s.T(), wiID), func() *goa.Service {
return goa.New("TestUnauthorizedCreateWorkItemRelationshipsLinks-Service")
}, func(service *goa.Service) error {
controller := NewWorkItemRelationshipsLinksController(service, gormapplication.NewGormDB(DB))
app.MountWorkItemRelationshipsLinksController(service, controller)
return nil
})
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:10,代码来源:work-item-link-blackbox_test.go
示例18: TestCreateTrackerQueryREST
func TestCreateTrackerQueryREST(t *testing.T) {
resource.Require(t, resource.Database)
privatekey, err := jwt.ParseRSAPrivateKeyFromPEM([]byte(almtoken.RSAPrivateKey))
if err != nil {
t.Fatal("Could not parse Key ", err)
}
service := goa.New("API")
controller := NewTrackerController(service, gormapplication.NewGormDB(DB), RwiScheduler)
payload := app.CreateTrackerAlternatePayload{
URL: "http://api.github.com",
Type: "github",
}
_, tracker := test.CreateTrackerCreated(t, nil, nil, controller, &payload)
jwtMiddleware := goajwt.New(&privatekey.PublicKey, nil, app.NewJWTSecurity())
app.UseJWTMiddleware(service, jwtMiddleware)
controller2 := NewTrackerqueryController(service, gormapplication.NewGormDB(DB), RwiScheduler)
app.MountTrackerqueryController(service, controller2)
server := httptest.NewServer(service.Mux)
tqPayload := fmt.Sprintf(`{"query": "abcdefgh", "schedule": "1 1 * * * *", "trackerID": "%s"}`, tracker.ID)
trackerQueryCreateURL := "/api/trackerqueries"
req, _ := http.NewRequest("POST", server.URL+trackerQueryCreateURL, strings.NewReader(tqPayload))
jwtToken := getValidAuthHeader(t, privatekey)
req.Header.Set("Authorization", jwtToken)
client := http.Client{}
res, err := client.Do(req)
if err != nil {
t.Fatalf("Server error %s", err)
}
if res.StatusCode != http.StatusCreated {
t.Fatalf("Expected a 201 Created response, got %d", res.StatusCode)
}
server.Close()
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:41,代码来源:trackerquery_blackbox_test.go
示例19: TestListIdentities
func TestListIdentities(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
service := goa.New("Test-Identities")
app := gormapplication.NewGormDB(DB)
identityController := NewIdentityController(service, app)
_, ic := test.ListIdentityOK(t, service.Context, service, identityController)
require.NotNil(t, ic)
numberOfCurrentIdent := len(ic.Data)
ctx := context.Background()
identityRepo := app.Identities()
identity := account.Identity{
Username: "TestUser",
Provider: "test-idp",
ID: uuid.NewV4(),
}
err := identityRepo.Create(ctx, &identity)
if err != nil {
t.Fatal(err)
}
_, ic2 := test.ListIdentityOK(t, service.Context, service, identityController)
require.NotNil(t, ic2)
assert.Equal(t, numberOfCurrentIdent+1, len(ic2.Data))
assertIdent(t, identity, findIdent(identity.ID, ic2.Data))
identity2 := account.Identity{
Username: "TestUser2",
Provider: "test-idp",
ID: uuid.NewV4(),
}
err = identityRepo.Create(ctx, &identity2)
if err != nil {
t.Fatal(err)
}
_, ic3 := test.ListIdentityOK(t, service.Context, service, identityController)
require.NotNil(t, ic3)
assert.Equal(t, numberOfCurrentIdent+2, len(ic3.Data))
assertIdent(t, identity, findIdent(identity.ID, ic3.Data))
assertIdent(t, identity2, findIdent(identity2.ID, ic3.Data))
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:52,代码来源:identity_blackbox_test.go
示例20: TestCreateTracker
func TestCreateTracker(t *testing.T) {
resource.Require(t, resource.Database)
defer cleaner.DeleteCreatedEntities(DB)()
controller := TrackerController{Controller: nil, db: gormapplication.NewGormDB(DB), scheduler: RwiScheduler}
payload := app.CreateTrackerAlternatePayload{
URL: "http://issues.jboss.com",
Type: "jira",
}
_, created := test.CreateTrackerCreated(t, nil, nil, &controller, &payload)
if created.ID == "" {
t.Error("no id")
}
}
开发者ID:Ritsyy,项目名称:almighty-core,代码行数:14,代码来源:tracker_test.go
注:本文中的github.com/almighty/almighty-core/gormapplication.NewGormDB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论