// loadViews adds views to run tests. func loadViews(context interface{}, db *db.DB) error { views, err := viewfix.Get() if err != nil { return err } if err := viewfix.Add(context, db, views[0:2]); err != nil { return err } return nil }
// setup initializes for each indivdual test. func setup(t *testing.T) ([]view.View, *db.DB) { tests.ResetLog() views, err := viewfix.Get() if err != nil { t.Fatalf("%s\tShould load view records from file : %v", tests.Failed, err) } t.Logf("%s\tShould load view records from file.", tests.Success) db, err := db.NewMGO(tests.Context, tests.TestSession) if err != nil { t.Fatalf("%s\tShould be able to get a Mongo session : %v", tests.Failed, err) } return views, db }