find permanodes matching a certain file query
(t *testing.T)
| 690 | |
| 691 | // find permanodes matching a certain file query |
| 692 | func TestQueryFileConstraint(t *testing.T) { |
| 693 | testQuery(t, func(qt *queryTest) { |
| 694 | id := qt.id |
| 695 | fileRef, _ := id.UploadFile("some-stuff.txt", "hello", time.Unix(123, 0)) |
| 696 | qt.t.Logf("fileRef = %q", fileRef) |
| 697 | p1 := id.NewPlannedPermanode("1") |
| 698 | id.SetAttribute(p1, "camliContent", fileRef.String()) |
| 699 | |
| 700 | fileRef2, _ := id.UploadFile("other-file", "hellooooo", time.Unix(456, 0)) |
| 701 | qt.t.Logf("fileRef2 = %q", fileRef2) |
| 702 | p2 := id.NewPlannedPermanode("2") |
| 703 | id.SetAttribute(p2, "camliContent", fileRef2.String()) |
| 704 | |
| 705 | sq := &SearchQuery{ |
| 706 | Constraint: &Constraint{ |
| 707 | Permanode: &PermanodeConstraint{ |
| 708 | Attr: "camliContent", |
| 709 | ValueInSet: &Constraint{ |
| 710 | File: &FileConstraint{ |
| 711 | FileName: &StringConstraint{ |
| 712 | Contains: "-stuff", |
| 713 | }, |
| 714 | FileSize: &IntConstraint{ |
| 715 | Max: 5, |
| 716 | }, |
| 717 | }, |
| 718 | }, |
| 719 | }, |
| 720 | }, |
| 721 | } |
| 722 | qt.wantRes(sq, p1) |
| 723 | }) |
| 724 | } |
| 725 | |
| 726 | // find a directory with a name |
| 727 | func TestQueryDirConstraint(t *testing.T) { |
nothing calls this directly
no test coverage detected