Esempio n. 1
0
func getTestRepo(t *testing.T, URL string) io.Reader {
	tr, err := repo.NewRepo(URL, TestRepoCredentialName, TestRepoBucket, TestRepoFormat, TestRepoType)
	if err != nil {
		t.Fatalf("Cannot create test repository: %s", err)
	}

	trb, err := json.Marshal(&tr)
	if err != nil {
		t.Fatalf("Cannot marshal test repository: %s", err)
	}

	return bytes.NewReader(trb)
}
Esempio n. 2
0
func getTestRepoProvider(t *testing.T) repo.IRepoProvider {
	rs := repo.NewInmemRepoService()
	rp := repo.NewRepoProvider(rs, nil, nil)
	tr, err := repo.NewRepo(TestRepoURL, TestRepoCredentialName, TestRepoName, TestRepoFormat, TestRepoType)
	if err != nil {
		t.Fatalf("cannot create test repository: %s", err)
	}

	if err := rs.CreateRepo(tr); err != nil {
		t.Fatalf("cannot initialize repository service: %s", err)
	}

	return rp
}