aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/postgres_test.go
diff options
context:
space:
mode:
authorChanning Kimble-Brown <channing@golang.org>2019-03-28 22:10:26 -0400
committerJulie Qiu <julie@golang.org>2020-03-27 16:46:34 -0400
commita90ca5573146b19836d4f3e130b86faebd31e773 (patch)
treec8200676b4e36f950f895add5d12145b59242c8f /internal/postgres/postgres_test.go
parent06f2b9a5131d816d3681f59cc6eb521ee06b7a87 (diff)
downloadgo-x-pkgsite-a90ca5573146b19836d4f3e130b86faebd31e773.tar.xz
content, internal/frontend, internal/postgres: add ability to render versions tab
fetchVersionsTabPage takes in a package path and a version and then returns all of the data needed to display the packages that have the same series and package suffix to make the versions tab content. The data is displayed in a hierarchical list of major (i.e. "v1") then major and minor (i.e. "1.2") and lastly the entirety of the version (i.e. "1.2.3" or "1.2.2-alpha.1"). verisons.tmpl is the template that displays all of the data in the VersionsTabPage struct. The routing was changed so that MakeFrontendHandlerFunc handles both /<import path>@<version> which brings up the overview page and /<import path>@<version>?tab=versions which brings up the versions tab. Fixes b/124308701 Change-Id: I92bd86d050ab6e7e669c07a750b325b3e026d052 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/443954 Reviewed-by: Julie Qiu <julieqiu@google.com>
Diffstat (limited to 'internal/postgres/postgres_test.go')
-rw-r--r--internal/postgres/postgres_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/postgres/postgres_test.go b/internal/postgres/postgres_test.go
index 92b15505..4b456b99 100644
--- a/internal/postgres/postgres_test.go
+++ b/internal/postgres/postgres_test.go
@@ -681,6 +681,12 @@ func TestPostgres_GetTaggedAndPseudoVersionsForPackageSeries(t *testing.T) {
License: "licensename",
Synopsis: pkg2.Synopsis,
CommitTime: now,
+ Packages: []*internal.Package{
+ &internal.Package{
+ Path: pkg2.Path,
+ Name: pkg2.Name,
+ },
+ },
},
&internal.Version{
Module: module2,
@@ -688,6 +694,12 @@ func TestPostgres_GetTaggedAndPseudoVersionsForPackageSeries(t *testing.T) {
License: "licensename",
Synopsis: pkg2.Synopsis,
CommitTime: now,
+ Packages: []*internal.Package{
+ &internal.Package{
+ Path: pkg2.Path,
+ Name: pkg2.Name,
+ },
+ },
},
&internal.Version{
Module: module1,
@@ -695,6 +707,12 @@ func TestPostgres_GetTaggedAndPseudoVersionsForPackageSeries(t *testing.T) {
License: "licensename",
Synopsis: pkg1.Synopsis,
CommitTime: now,
+ Packages: []*internal.Package{
+ &internal.Package{
+ Path: pkg1.Path,
+ Name: pkg1.Name,
+ },
+ },
},
&internal.Version{
Module: module1,
@@ -702,6 +720,12 @@ func TestPostgres_GetTaggedAndPseudoVersionsForPackageSeries(t *testing.T) {
License: "licensename",
Synopsis: pkg1.Synopsis,
CommitTime: now,
+ Packages: []*internal.Package{
+ &internal.Package{
+ Path: pkg1.Path,
+ Name: pkg1.Name,
+ },
+ },
},
},
},
@@ -745,6 +769,12 @@ func TestPostgres_GetTaggedAndPseudoVersionsForPackageSeries(t *testing.T) {
License: "licensename",
Synopsis: pkg1.Synopsis,
CommitTime: now,
+ Packages: []*internal.Package{
+ &internal.Package{
+ Path: pkg1.Path,
+ Name: pkg1.Name,
+ },
+ },
})
}
}