registry: Support the created_at field

Registries now have creation times.
This commit is contained in:
Adam Wolfe Gordon 2020-01-24 13:26:52 -07:00
parent 22da6b907f
commit 1037e4b30b
2 changed files with 10 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"context"
"fmt"
"net/http"
"time"
)
const (
@ -41,7 +42,8 @@ type RegistryDockerCredentialsRequest struct {
// Registry represents a registry.
type Registry struct {
Name string `json:"name,omitempty"`
Name string `json:"name,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type registryRoot struct {

View File

@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/require"
)
@ -13,8 +14,11 @@ func TestRegistry_Create(t *testing.T) {
setup()
defer teardown()
createdAt, err := time.Parse(time.RFC3339, "2020-01-24T20:24:31Z")
require.NoError(t, err)
want := &Registry{
Name: "foo",
Name: "foo",
CreatedAt: createdAt,
}
createRequest := &RegistryCreateRequest{
@ -24,7 +28,8 @@ func TestRegistry_Create(t *testing.T) {
createResponseJSON := `
{
"registry": {
"name": "foo"
"name": "foo",
"created_at": "2020-01-24T20:24:31Z"
}
}`