示例#1
0
// loadSubmissions adds submissions to run tests.
func loadSubmissions(db *db.DB) error {
	f, submissions, err := aggfix.Get()
	if err != nil {
		return err
	}

	if err := aggfix.Add(tests.Context, db, f, submissions); err != nil {
		return err
	}

	return nil
}
示例#2
0
func setupAgg(t *testing.T) (*form.Form, []submission.Submission, *db.DB) {
	tests.ResetLog()

	fm, subs, err := aggfix.Get()
	if err != nil {
		t.Fatalf("%s\tShould be able retrieve form and submission fixture : %s", tests.Failed, err)
	}

	db, err := db.NewMGO(tests.Context, tests.TestSession)
	if err != nil {
		t.Fatalf("Should be able to get a Mongo session : %v", err)
	}

	if err := aggfix.Add(tests.Context, db, fm, subs); err != nil {
		t.Fatalf("Should be able to add forms and submissions to the database : %v", err)
	}

	return fm, subs, db
}