move source metadata upstream and fix tests

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2020-11-17 12:37:12 -05:00
parent aa0d444fd4
commit 6f7a4fd3e4
36 changed files with 305 additions and 294 deletions
+1 -3
View File
@@ -37,7 +37,7 @@ func TestCatalogFromJSON(t *testing.T) {
}
var buf bytes.Buffer
jsonPres := json.NewPresenter(expectedCatalog, *s, *expectedDistro)
jsonPres := json.NewPresenter(expectedCatalog, s.Metadata, *expectedDistro)
if err = jsonPres.Present(&buf); err != nil {
t.Fatalf("failed to write to presenter: %+v", err)
}
@@ -73,8 +73,6 @@ func TestCatalogFromJSON(t *testing.T) {
a := actualPackages[i]
// omit fields that should be missing
e.Locations = nil
e.FoundBy = ""
if e.MetadataType == pkg.JavaMetadataType {
metadata := e.Metadata.(pkg.JavaMetadata)
metadata.Parent = nil
+1 -1
View File
@@ -67,7 +67,7 @@ func testJsonSchema(t *testing.T, catalog *pkg.Catalog, theScope *source.Source,
t.Fatalf("bad distro: %+v", err)
}
p := presenter.GetPresenter(presenter.JSONPresenter, *theScope, catalog, &d)
p := presenter.GetPresenter(presenter.JSONPresenter, theScope.Metadata, catalog, &d)
if p == nil {
t.Fatal("unable to get presenter")
}