func TestByChecksumSetsTheProperFields(t *testing.T) { actual := search.ByChecksum("sha1").Parameters() expected := map[string]string{"sha1": "sha1"} diff, onlyExpected, onlyActual := util.MapDiff(expected, actual) for _, key := range diff { t.Errorf("Mismatch on key %q: expected value %q, got %q", key, expected[key], actual[key]) } for _, key := range onlyExpected { t.Errorf("Missing key %q", key) } for _, key := range onlyActual { t.Errorf("Unexpected key %q", key) } }
func TestByChecksumImplementsCriteria(t *testing.T) { if _, ok := interface{}(search.ByChecksum("")).(search.Criteria); !ok { t.Errorf("search.ByChecksum does not implement Criteria!") } }