auth/internal/domain/profile.go

36 lines
778 B
Go
Raw Normal View History

package domain
2021-12-29 20:08:30 +00:00
import (
"net/url"
2021-12-29 20:08:30 +00:00
"testing"
)
// Profile describes the data about the user.
type Profile struct {
Photo *url.URL `json:"photo,omitempty"`
URL *url.URL `json:"url,omitempty"`
Email *Email `json:"email,omitempty"`
Name string `json:"name,omitempty"`
}
2022-02-17 14:58:13 +00:00
func NewProfile() *Profile {
return &Profile{
Photo: new(url.URL),
URL: new(url.URL),
Email: new(Email),
Name: "",
2022-02-17 14:58:13 +00:00
}
}
2021-12-29 20:08:30 +00:00
// TestProfile returns a valid Profile with the generated test data filled in.
func TestProfile(tb testing.TB) *Profile {
tb.Helper()
return &Profile{
Email: TestEmail(tb),
Name: "Example User",
Photo: &url.URL{Scheme: "https", Host: "user.example.net", Path: "/photo.jpg"},
URL: &url.URL{Scheme: "https", Host: "user.example.net", Path: "/"},
}
}