internal/postgres: replace LegacyPackage in TestGetLicenses
For golang/go#39629
Change-Id: I716db31922143f59c7ba4bef85723a64089cf85f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/262757
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/postgres/licenses_test.go b/internal/postgres/licenses_test.go
index 71130d2..15da575 100644
--- a/internal/postgres/licenses_test.go
+++ b/internal/postgres/licenses_test.go
@@ -124,16 +124,16 @@
func TestGetModuleLicenses(t *testing.T) {
modulePath := "test.module"
testModule := sample.LegacyModule(modulePath, "v1.2.3", "", "foo", "bar")
- testModule.LegacyPackages[0].Licenses = []*licenses.Metadata{{Types: []string{"ISC"}, FilePath: "LICENSE"}}
- testModule.LegacyPackages[1].Licenses = []*licenses.Metadata{{Types: []string{"MIT"}, FilePath: "foo/LICENSE"}}
- testModule.LegacyPackages[2].Licenses = []*licenses.Metadata{{Types: []string{"GPL2"}, FilePath: "bar/LICENSE.txt"}}
+ testModule.Packages()[0].Licenses = []*licenses.Metadata{{Types: []string{"ISC"}, FilePath: "LICENSE"}}
+ testModule.Packages()[1].Licenses = []*licenses.Metadata{{Types: []string{"MIT"}, FilePath: "foo/LICENSE"}}
+ testModule.Packages()[2].Licenses = []*licenses.Metadata{{Types: []string{"GPL2"}, FilePath: "bar/LICENSE.txt"}}
defer ResetTestDB(testDB, t)
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
defer cancel()
testModule.Licenses = nil
- for _, p := range testModule.LegacyPackages {
+ for _, p := range testModule.Packages() {
testModule.Licenses = append(testModule.Licenses, &licenses.License{
Metadata: p.Licenses[0],
Contents: []byte(`Lorem Ipsum`),
@@ -201,7 +201,7 @@
m := sample.LegacyModule(sample.ModulePath, "v1.2.3", "")
sample.AddLicense(m, sample.NonRedistributableLicense)
m.IsRedistributable = false
- m.LegacyPackages[0].IsRedistributable = false
+ m.Packages()[0].IsRedistributable = false
m.Units[0].IsRedistributable = false
return m
}