initial setup of perma123 lastModtime is at test.ClockOrigin + 8s (last claim on perma123) on return.
(t *testing.T)
| 195 | // initial setup of perma123 |
| 196 | // lastModtime is at test.ClockOrigin + 8s (last claim on perma123) on return. |
| 197 | func handlerDescribeTestSetup(t *testing.T) indexAndOwner { |
| 198 | idx := index.NewMemoryIndex() |
| 199 | tf := new(test.Fetcher) |
| 200 | idx.InitBlobSource(tf) |
| 201 | idx.KeyFetcher = tf |
| 202 | fi := &fetcherIndex{ |
| 203 | tf: tf, |
| 204 | idx: idx, |
| 205 | } |
| 206 | |
| 207 | checkErr(t, fi.addBlob(ownerRef)) |
| 208 | perma123 := testBlobs["perma-123"] |
| 209 | fi.addBlob(perma123) |
| 210 | fakeref232 := testBlobs["fakeref-232"] |
| 211 | checkErr(t, fi.addBlob(fakeref232)) |
| 212 | |
| 213 | lastModtime = test.ClockOrigin |
| 214 | checkErr(t, fi.addClaim(schema.NewSetAttributeClaim(perma123.BlobRef(), "camliContent", fakeref232.BlobRef().String()))) |
| 215 | |
| 216 | // Test deleting all attributes |
| 217 | checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "wont-be-present", "x"))) |
| 218 | checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "wont-be-present", "y"))) |
| 219 | checkErr(t, fi.addClaim(schema.NewDelAttributeClaim(perma123.BlobRef(), "wont-be-present", ""))) |
| 220 | |
| 221 | // Test deleting a specific attribute. |
| 222 | checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "only-delete-b", "a"))) |
| 223 | checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "only-delete-b", "b"))) |
| 224 | checkErr(t, fi.addClaim(schema.NewAddAttributeClaim(perma123.BlobRef(), "only-delete-b", "c"))) |
| 225 | checkErr(t, fi.addClaim(schema.NewDelAttributeClaim(perma123.BlobRef(), "only-delete-b", "b"))) |
| 226 | |
| 227 | return indexAndOwner{ |
| 228 | index: idx, |
| 229 | owner: owner.BlobRef(), |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | // extends handlerDescribeTestSetup but adds a camliContentImage to pn. |
| 234 | // lastModtime is at test.ClockOrigin + 9s on return. |
no test coverage detected