fix(http): refactoring to support uint64 platform.IDs
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com> Co-Authored-By: Lorenzo Fontana <lo@linux.com>pull/10616/head
parent
4454ff7398
commit
9fa032da28
|
|
@ -44,15 +44,15 @@ func TestService_handleGetBuckets(t *testing.T) {
|
|||
FindBucketsFn: func(ctx context.Context, filter platform.BucketFilter, opts ...platform.FindOptions) ([]*platform.Bucket, int, error) {
|
||||
return []*platform.Bucket{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("0b501e7e557ab1ed"),
|
||||
Name: "hello",
|
||||
OrganizationID: platform.ID("10"),
|
||||
OrganizationID: platformtesting.MustIDFromString("50f7ba1150f7ba11"),
|
||||
RetentionPeriod: 2 * time.Second,
|
||||
},
|
||||
{
|
||||
ID: platform.ID("2"),
|
||||
ID: platformtesting.MustIDFromString("c0175f0077a77005"),
|
||||
Name: "example",
|
||||
OrganizationID: platform.ID("20"),
|
||||
OrganizationID: platformtesting.MustIDFromString("7e55e118dbabb1ed"),
|
||||
RetentionPeriod: 24 * time.Hour,
|
||||
},
|
||||
}, 2, nil
|
||||
|
|
@ -71,21 +71,21 @@ func TestService_handleGetBuckets(t *testing.T) {
|
|||
"buckets": [
|
||||
{
|
||||
"links": {
|
||||
"org": "/api/v2/orgs/3130",
|
||||
"self": "/api/v2/buckets/30"
|
||||
"org": "/api/v2/orgs/50f7ba1150f7ba11",
|
||||
"self": "/api/v2/buckets/0b501e7e557ab1ed"
|
||||
},
|
||||
"id": "30",
|
||||
"organizationID": "3130",
|
||||
"id": "0b501e7e557ab1ed",
|
||||
"organizationID": "50f7ba1150f7ba11",
|
||||
"name": "hello",
|
||||
"retentionPeriod": "2s"
|
||||
},
|
||||
{
|
||||
"links": {
|
||||
"org": "/api/v2/orgs/3230",
|
||||
"self": "/api/v2/buckets/32"
|
||||
"org": "/api/v2/orgs/7e55e118dbabb1ed",
|
||||
"self": "/api/v2/buckets/c0175f0077a77005"
|
||||
},
|
||||
"id": "32",
|
||||
"organizationID": "3230",
|
||||
"id": "c0175f0077a77005",
|
||||
"organizationID": "7e55e118dbabb1ed",
|
||||
"name": "example",
|
||||
"retentionPeriod": "1d"
|
||||
}
|
||||
|
|
@ -179,12 +179,11 @@ func TestService_handleGetBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
FindBucketByIDFn: func(ctx context.Context, id platform.ID) (*platform.Bucket, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return &platform.Bucket{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
OrganizationID: mustParseID("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
RetentionPeriod: 30 * time.Second,
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
OrganizationID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +292,7 @@ func TestService_handlePostBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
CreateBucketFn: func(ctx context.Context, c *platform.Bucket) error {
|
||||
c.ID = mustParseID("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -301,7 +300,7 @@ func TestService_handlePostBucket(t *testing.T) {
|
|||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "hello",
|
||||
OrganizationID: platform.ID("0"),
|
||||
OrganizationID: platformtesting.MustIDFromString("6f626f7274697320"),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -310,11 +309,12 @@ func TestService_handlePostBucket(t *testing.T) {
|
|||
body: `
|
||||
{
|
||||
"links": {
|
||||
"org": "/api/v2/orgs/30",
|
||||
"org": "/api/v2/orgs/6f626f7274697320",
|
||||
"self": "/api/v2/buckets/020f755c3c082000"
|
||||
},
|
||||
"id": "020f755c3c082000",
|
||||
"organizationID": "30",
|
||||
"organizationID": "6f626f7274697320",
|
||||
"organization": "30",
|
||||
"name": "hello",
|
||||
"retentionPeriod": "0s"
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ func TestService_handleDeleteBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
DeleteBucketFn: func(ctx context.Context, id platform.ID) error {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -477,11 +477,11 @@ func TestService_handlePatchBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
UpdateBucketFn: func(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
d := &platform.Bucket{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
OrganizationID: mustParseID("020f755c3c082000"),
|
||||
OrganizationID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
}
|
||||
|
||||
if upd.Name != nil {
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ func decodePatchDashboardRequest(ctx context.Context, r *http.Request) (*patchDa
|
|||
|
||||
// Valid validates that the dashboard ID is non zero valued and update has expected values set.
|
||||
func (r *patchDashboardRequest) Valid() error {
|
||||
if len(r.DashboardID) == 0 {
|
||||
if !r.DashboardID.Valid() {
|
||||
return fmt.Errorf("missing dashboard ID")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,21 +43,21 @@ func TestService_handleGetDashboards(t *testing.T) {
|
|||
FindDashboardsF: func(ctx context.Context, filter platform.DashboardFilter) ([]*platform.Dashboard, int, error) {
|
||||
return []*platform.Dashboard{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platform.ID("1"),
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: platform.ID("2"),
|
||||
ID: platformtesting.MustIDFromString("0ca2204eca2204e0"),
|
||||
Name: "example",
|
||||
},
|
||||
}, 2, nil
|
||||
|
|
@ -75,34 +75,34 @@ func TestService_handleGetDashboards(t *testing.T) {
|
|||
},
|
||||
"dashboards": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "da7aba5e5d81e550",
|
||||
"name": "hello",
|
||||
"cells": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "da7aba5e5d81e550",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"w": 3,
|
||||
"h": 4,
|
||||
"viewID": "31",
|
||||
"viewID": "ba0bab707a11ed12",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/30/cells/30",
|
||||
"view": "/api/v2/views/31"
|
||||
"self": "/api/v2/dashboards/da7aba5e5d81e550/cells/da7aba5e5d81e550",
|
||||
"view": "/api/v2/views/ba0bab707a11ed12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/30",
|
||||
"cells": "/api/v2/dashboards/30/cells"
|
||||
"self": "/api/v2/dashboards/da7aba5e5d81e550",
|
||||
"cells": "/api/v2/dashboards/da7aba5e5d81e550/cells"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "32",
|
||||
"id": "0ca2204eca2204e0",
|
||||
"name": "example",
|
||||
"cells": [],
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/32",
|
||||
"cells": "/api/v2/dashboards/32/cells"
|
||||
"self": "/api/v2/dashboards/0ca2204eca2204e0",
|
||||
"cells": "/api/v2/dashboards/0ca2204eca2204e0/cells"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -195,18 +195,18 @@ func TestService_handleGetDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
FindDashboardByIDF: func(ctx context.Context, id platform.ID) (*platform.Dashboard, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return &platform.Dashboard{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platform.ID("1"),
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
|
|
@ -228,15 +228,15 @@ func TestService_handleGetDashboard(t *testing.T) {
|
|||
"name": "hello",
|
||||
"cells": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "da7aba5e5d81e550",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"w": 3,
|
||||
"h": 4,
|
||||
"viewID": "31",
|
||||
"viewID": "ba0bab707a11ed12",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/30",
|
||||
"view": "/api/v2/views/31"
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/da7aba5e5d81e550",
|
||||
"view": "/api/v2/views/ba0bab707a11ed12"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
@ -328,22 +328,23 @@ func TestService_handlePostDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
CreateDashboardF: func(ctx context.Context, c *platform.Dashboard) error {
|
||||
c.ID = mustParseID("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboard: &platform.Dashboard{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platform.ID("1"),
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -357,15 +358,15 @@ func TestService_handlePostDashboard(t *testing.T) {
|
|||
"name": "hello",
|
||||
"cells": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "da7aba5e5d81e550",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"w": 3,
|
||||
"h": 4,
|
||||
"viewID": "31",
|
||||
"viewID": "ba0bab707a11ed12",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/30",
|
||||
"view": "/api/v2/views/31"
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/da7aba5e5d81e550",
|
||||
"view": "/api/v2/views/ba0bab707a11ed12"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
@ -435,7 +436,7 @@ func TestService_handleDeleteDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
DeleteDashboardF: func(ctx context.Context, id platform.ID) error {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -532,18 +533,18 @@ func TestService_handlePatchDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
UpdateDashboardF: func(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
d := &platform.Dashboard{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platform.ID("1"),
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -572,15 +573,15 @@ func TestService_handlePatchDashboard(t *testing.T) {
|
|||
"name": "example",
|
||||
"cells": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "da7aba5e5d81e550",
|
||||
"x": 1,
|
||||
"y": 2,
|
||||
"w": 3,
|
||||
"h": 4,
|
||||
"viewID": "31",
|
||||
"viewID": "ba0bab707a11ed12",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/30",
|
||||
"view": "/api/v2/views/31"
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/da7aba5e5d81e550",
|
||||
"view": "/api/v2/views/ba0bab707a11ed12"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
@ -700,7 +701,7 @@ func TestService_handlePostDashboardCell(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
AddDashboardCellF: func(ctx context.Context, id platform.ID, c *platform.Cell, opt platform.AddDashboardCellOptions) error {
|
||||
c.ID = mustParseID("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -708,9 +709,10 @@ func TestService_handlePostDashboardCell(t *testing.T) {
|
|||
args: args{
|
||||
id: "020f755c3c082000",
|
||||
cell: &platform.Cell{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
X: 10,
|
||||
Y: 11,
|
||||
ViewID: platform.ID("0"),
|
||||
ViewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -723,10 +725,10 @@ func TestService_handlePostDashboardCell(t *testing.T) {
|
|||
"y": 11,
|
||||
"w": 0,
|
||||
"h": 0,
|
||||
"viewID": "30",
|
||||
"viewID": "da7aba5e5d81e550",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/020f755c3c082000",
|
||||
"view": "/api/v2/views/30"
|
||||
"view": "/api/v2/views/da7aba5e5d81e550"
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
|
@ -889,8 +891,8 @@ func TestService_handlePatchDashboardCell(t *testing.T) {
|
|||
&mock.DashboardService{
|
||||
UpdateDashboardCellF: func(ctx context.Context, id, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error) {
|
||||
cell := &platform.Cell{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ViewID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ViewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
}
|
||||
|
||||
if err := upd.Apply(cell); err != nil {
|
||||
|
|
@ -904,6 +906,7 @@ func TestService_handlePatchDashboardCell(t *testing.T) {
|
|||
args: args{
|
||||
id: "020f755c3c082000",
|
||||
cellID: "020f755c3c082000",
|
||||
viewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
x: 10,
|
||||
y: 11,
|
||||
},
|
||||
|
|
@ -917,10 +920,10 @@ func TestService_handlePatchDashboardCell(t *testing.T) {
|
|||
"y": 11,
|
||||
"w": 0,
|
||||
"h": 0,
|
||||
"viewID": "30",
|
||||
"viewID": "da7aba5e5d81e550",
|
||||
"links": {
|
||||
"self": "/api/v2/dashboards/020f755c3c082000/cells/020f755c3c082000",
|
||||
"view": "/api/v2/views/30"
|
||||
"view": "/api/v2/views/da7aba5e5d81e550"
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
|
@ -946,8 +949,8 @@ func TestService_handlePatchDashboardCell(t *testing.T) {
|
|||
if tt.args.h != 0 {
|
||||
upd.H = &tt.args.h
|
||||
}
|
||||
if len(tt.args.viewID) != 0 {
|
||||
upd.ViewID = &tt.args.viewID
|
||||
if tt.args.viewID.Valid() {
|
||||
upd.ViewID = tt.args.viewID
|
||||
}
|
||||
|
||||
b, err := json.Marshal(upd)
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ func decodePatchViewRequest(ctx context.Context, r *http.Request) (*patchViewReq
|
|||
|
||||
// Valid validates that the view ID is non zero valued and update has expected values set.
|
||||
func (r *patchViewRequest) Valid() error {
|
||||
if len(r.ViewID) == 0 {
|
||||
if !r.ViewID.Valid() {
|
||||
return fmt.Errorf("missing view ID")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/platform"
|
||||
"github.com/influxdata/platform/mock"
|
||||
platformtesting "github.com/influxdata/platform/testing"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
return []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platform.ID("0"),
|
||||
ID: platformtesting.MustIDFromString("7365637465747572"),
|
||||
Name: "hello",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -52,7 +53,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platform.ID("2"),
|
||||
ID: platformtesting.MustIDFromString("6167697474697320"),
|
||||
Name: "example",
|
||||
},
|
||||
},
|
||||
|
|
@ -71,10 +72,10 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
},
|
||||
"views": [
|
||||
{
|
||||
"id": "30",
|
||||
"id": "7365637465747572",
|
||||
"name": "hello",
|
||||
"links": {
|
||||
"self": "/api/v2/views/30"
|
||||
"self": "/api/v2/views/7365637465747572"
|
||||
},
|
||||
"properties": {
|
||||
"shape": "chronograf-v2",
|
||||
|
|
@ -86,10 +87,10 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
}
|
||||
},
|
||||
{
|
||||
"id": "32",
|
||||
"id": "6167697474697320",
|
||||
"name": "example",
|
||||
"links": {
|
||||
"self": "/api/v2/views/32"
|
||||
"self": "/api/v2/views/6167697474697320"
|
||||
},
|
||||
"properties": {
|
||||
"shape": "empty"
|
||||
|
|
@ -186,7 +187,7 @@ func TestService_handleGetView(t *testing.T) {
|
|||
FindViewByIDF: func(ctx context.Context, id platform.ID) (*platform.View, error) {
|
||||
return &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
}, nil
|
||||
|
|
@ -293,7 +294,7 @@ func TestService_handlePostViews(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
CreateViewF: func(ctx context.Context, c *platform.View) error {
|
||||
c.ID = mustParseID("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -301,6 +302,7 @@ func TestService_handlePostViews(t *testing.T) {
|
|||
args: args{
|
||||
view: &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -388,7 +390,7 @@ func TestService_handleDeleteView(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
DeleteViewF: func(ctx context.Context, id platform.ID) error {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -485,10 +487,10 @@ func TestService_handlePatchView(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
UpdateViewF: func(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -532,10 +534,10 @@ func TestService_handlePatchView(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
UpdateViewF: func(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error) {
|
||||
if bytes.Equal(id, mustParseID("020f755c3c082000")) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
return &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: mustParseID("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -637,11 +639,3 @@ func jsonEqual(s1, s2 string) (eq bool, err error) {
|
|||
|
||||
return cmp.Equal(o1, o2), nil
|
||||
}
|
||||
|
||||
func mustParseID(i string) platform.ID {
|
||||
id, err := platform.IDFromString(i)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return *id
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue