func testGetMultStatementOfGroup(t *testing.T, group *gabs.Container) { db := initDatabase(t) defer db.Close() mart := initHandler(db) ids := []string{ uuid.NewV4().String(), uuid.NewV4().String(), uuid.NewV4().String(), uuid.NewV4().String(), } stmt, err := gabs.ParseJSON([]byte(statetmentAgentBoilerplate)) fatalIfError(t, err) stmtSlice := []*gabs.Container{ appendAccount(t, stmt), appendMbox(t, stmt), appendMboxSHA1(t, stmt), appendOpenID(t, stmt), } for i := 0; i < len(ids); i++ { putStatement(t, mart, stmtSlice[i].String(), ids[i]) var s interface{} err = json.Unmarshal([]byte(stmtSlice[i].Search("actor").String()), &s) fatalIfError(t, err) err = group.ArrayAppendP(s, "actor.member") fatalIfError(t, err) } // construct query v := &url.Values{} //t.Log(group.Search("actor").String()) v.Add("agent", group.Search("actor").String()) resp := getStatement(t, mart, v) //t.Log(string(resp)) respstmt, err := gabs.ParseJSON(resp) fatalIfError(t, err) cnt, err := respstmt.ArrayCount("statements") fatalIfError(t, err) if cnt != len(ids) { t.Fatalf("Expected %d statements in response; got %d", len(ids), cnt) } children, err := respstmt.S("statements").Children() fatalIfError(t, err) for idx, stm := range children { if id, ok := stm.Search("id").Data().(string); !ok || id != ids[idx] { t.Fatalf("Got invalid order of statement array") } } }