Ejemplo n.º 1
0
func TestByRepositorySetsTheProperFields(t *testing.T) {
	actual := search.ByRepository("repositoryId").Parameters()
	expected := map[string]string{"repositoryId": "repositoryId"}

	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)
	}
}
Ejemplo n.º 2
0
func TestInRepositoryWithSearchAllIsTheSameAsByRepository(t *testing.T) {
	actual := search.InRepository{RepositoryID: "repositoryId", Criteria: search.All}.Parameters()
	expected := search.ByRepository("repositoryId").Parameters()

	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)
	}
}
Ejemplo n.º 3
0
func TestByRepositoryImplementsCriteria(t *testing.T) {
	if _, ok := interface{}(search.ByRepository("")).(search.Criteria); !ok {
		t.Errorf("search.ByRepository does not implement Criteria!")
	}
}