refactor(testing): rename MustIDFromString to MustIDBase16
parent
586b5b67c1
commit
2bea48f15a
|
|
@ -79,7 +79,7 @@ func TestBasicAuth(t *testing.T) {
|
|||
users: []*platform.User{
|
||||
{
|
||||
Name: "user1",
|
||||
ID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
ID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -96,7 +96,7 @@ func TestBasicAuth(t *testing.T) {
|
|||
users: []*platform.User{
|
||||
{
|
||||
Name: "user1",
|
||||
ID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
ID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -184,7 +184,7 @@ func TestBasicAuth_CompareAndSet(t *testing.T) {
|
|||
users: []*platform.User{
|
||||
{
|
||||
Name: "user1",
|
||||
ID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
ID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func TestDBRPMapping_Validate(t *testing.T) {
|
|||
Cluster: "abc",
|
||||
Database: "telegraf",
|
||||
RetentionPolicy: "autogen",
|
||||
OrganizationID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
OrganizationID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
|
@ -94,8 +94,8 @@ func TestDBRPMapping_Validate(t *testing.T) {
|
|||
Cluster: "12345_.",
|
||||
Database: "howdy-doody",
|
||||
RetentionPolicy: "autogen",
|
||||
OrganizationID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
BucketID: platformtesting.MustIDFromString("5ca1ab1edeadbea7"),
|
||||
OrganizationID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
BucketID: platformtesting.MustIDBase16("5ca1ab1edeadbea7"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ func TestScheduler(t *testing.T) {
|
|||
Metrics: make(map[int64]Metrics),
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("3a0d0a6365646120"),
|
||||
ID: platformtesting.MustIDBase16("3a0d0a6365646120"),
|
||||
Type: platform.PrometheusScraperType,
|
||||
URL: ts.URL + "/metrics",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ func TestService_handleGetAuthorizations(t *testing.T) {
|
|||
FindAuthorizationsFn: func(ctx context.Context, filter platform.AuthorizationFilter, opts ...platform.FindOptions) ([]*platform.Authorization, int, error) {
|
||||
return []*platform.Authorization{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("0d0a657820696e74"),
|
||||
ID: platformtesting.MustIDBase16("0d0a657820696e74"),
|
||||
Token: "hello",
|
||||
UserID: platformtesting.MustIDFromString("2070616e656d2076"),
|
||||
UserID: platformtesting.MustIDBase16("2070616e656d2076"),
|
||||
},
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("6669646573207375"),
|
||||
ID: platformtesting.MustIDBase16("6669646573207375"),
|
||||
Token: "example",
|
||||
UserID: platformtesting.MustIDFromString("6c7574652c206f6e"),
|
||||
UserID: platformtesting.MustIDBase16("6c7574652c206f6e"),
|
||||
},
|
||||
}, 2, nil
|
||||
},
|
||||
|
|
@ -177,10 +177,10 @@ func TestService_handleGetAuthorization(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.AuthorizationService{
|
||||
FindAuthorizationByIDFn: func(ctx context.Context, id platform.ID) (*platform.Authorization, error) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return &platform.Authorization{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Token: "hello",
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ func TestService_handlePostAuthorization(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.AuthorizationService{
|
||||
CreateAuthorizationFn: func(ctx context.Context, c *platform.Authorization) error {
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDBase16("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -298,8 +298,8 @@ func TestService_handlePostAuthorization(t *testing.T) {
|
|||
args: args{
|
||||
authorization: &platform.Authorization{
|
||||
Token: "hello",
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -377,7 +377,7 @@ func TestService_handleDeleteAuthorization(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.AuthorizationService{
|
||||
DeleteAuthorizationFn: func(ctx context.Context, id platform.ID) error {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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: platformtesting.MustIDFromString("0b501e7e557ab1ed"),
|
||||
ID: platformtesting.MustIDBase16("0b501e7e557ab1ed"),
|
||||
Name: "hello",
|
||||
OrganizationID: platformtesting.MustIDFromString("50f7ba1150f7ba11"),
|
||||
OrganizationID: platformtesting.MustIDBase16("50f7ba1150f7ba11"),
|
||||
RetentionPeriod: 2 * time.Second,
|
||||
},
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("c0175f0077a77005"),
|
||||
ID: platformtesting.MustIDBase16("c0175f0077a77005"),
|
||||
Name: "example",
|
||||
OrganizationID: platformtesting.MustIDFromString("7e55e118dbabb1ed"),
|
||||
OrganizationID: platformtesting.MustIDBase16("7e55e118dbabb1ed"),
|
||||
RetentionPeriod: 24 * time.Hour,
|
||||
},
|
||||
}, 2, nil
|
||||
|
|
@ -179,10 +179,10 @@ func TestService_handleGetBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
FindBucketByIDFn: func(ctx context.Context, id platform.ID) (*platform.Bucket, error) {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return &platform.Bucket{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
OrganizationID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
OrganizationID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
RetentionPeriod: 30 * time.Second,
|
||||
}, nil
|
||||
|
|
@ -293,7 +293,7 @@ func TestService_handlePostBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
CreateBucketFn: func(ctx context.Context, c *platform.Bucket) error {
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDBase16("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -301,7 +301,7 @@ func TestService_handlePostBucket(t *testing.T) {
|
|||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "hello",
|
||||
OrganizationID: platformtesting.MustIDFromString("6f626f7274697320"),
|
||||
OrganizationID: platformtesting.MustIDBase16("6f626f7274697320"),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -380,7 +380,7 @@ func TestService_handleDeleteBucket(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.BucketService{
|
||||
DeleteBucketFn: func(ctx context.Context, id platform.ID) error {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("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 id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
d := &platform.Bucket{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
OrganizationID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
OrganizationID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
}
|
||||
|
||||
if upd.Name != nil {
|
||||
|
|
|
|||
|
|
@ -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: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
ViewID: platformtesting.MustIDBase16("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("0ca2204eca2204e0"),
|
||||
ID: platformtesting.MustIDBase16("0ca2204eca2204e0"),
|
||||
Name: "example",
|
||||
},
|
||||
}, 2, nil
|
||||
|
|
@ -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 id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return &platform.Dashboard{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
ViewID: platformtesting.MustIDBase16("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
|
|
@ -328,23 +328,23 @@ func TestService_handlePostDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
CreateDashboardF: func(ctx context.Context, c *platform.Dashboard) error {
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDBase16("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboard: &platform.Dashboard{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
ViewID: platformtesting.MustIDBase16("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -436,7 +436,7 @@ func TestService_handleDeleteDashboard(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.DashboardService{
|
||||
DeleteDashboardF: func(ctx context.Context, id platform.ID) error {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -533,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 id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
d := &platform.Dashboard{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
X: 1,
|
||||
Y: 2,
|
||||
W: 3,
|
||||
H: 4,
|
||||
ViewID: platformtesting.MustIDFromString("ba0bab707a11ed12"),
|
||||
ViewID: platformtesting.MustIDBase16("ba0bab707a11ed12"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -701,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 = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDBase16("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -709,10 +709,10 @@ func TestService_handlePostDashboardCell(t *testing.T) {
|
|||
args: args{
|
||||
id: "020f755c3c082000",
|
||||
cell: &platform.Cell{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
X: 10,
|
||||
Y: 11,
|
||||
ViewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ViewID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -891,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: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ViewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
ViewID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
}
|
||||
|
||||
if err := upd.Apply(cell); err != nil {
|
||||
|
|
@ -906,7 +906,7 @@ func TestService_handlePatchDashboardCell(t *testing.T) {
|
|||
args: args{
|
||||
id: "020f755c3c082000",
|
||||
cellID: "020f755c3c082000",
|
||||
viewID: platformtesting.MustIDFromString("da7aba5e5d81e550"),
|
||||
viewID: platformtesting.MustIDBase16("da7aba5e5d81e550"),
|
||||
x: 10,
|
||||
y: 11,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func TestMacroService_handleGetMacros(t *testing.T) {
|
|||
FindMacrosF: func(ctx context.Context) ([]*platform.Macro, error) {
|
||||
return []*platform.Macro{
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("6162207574726f71"),
|
||||
ID: platformtesting.MustIDBase16("6162207574726f71"),
|
||||
Name: "macro-a",
|
||||
Selected: []string{"b"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -46,7 +46,7 @@ func TestMacroService_handleGetMacros(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: platformtesting.MustIDFromString("61726920617a696f"),
|
||||
ID: platformtesting.MustIDBase16("61726920617a696f"),
|
||||
Name: "macro-b",
|
||||
Selected: []string{"c"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -123,7 +123,7 @@ func TestMacroService_handleGetMacro(t *testing.T) {
|
|||
&mock.MacroService{
|
||||
FindMacroByIDF: func(ctx context.Context, id platform.ID) (*platform.Macro, error) {
|
||||
return &platform.Macro{
|
||||
ID: platformtesting.MustIDFromString("75650d0a636f6d70"),
|
||||
ID: platformtesting.MustIDBase16("75650d0a636f6d70"),
|
||||
Name: "macro-a",
|
||||
Selected: []string{"b"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -222,7 +222,7 @@ func TestMacroService_handlePostMacro(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.MacroService{
|
||||
CreateMacroF: func(ctx context.Context, m *platform.Macro) error {
|
||||
m.ID = platformtesting.MustIDFromString("75650d0a636f6d70")
|
||||
m.ID = platformtesting.MustIDBase16("75650d0a636f6d70")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -256,7 +256,7 @@ func TestMacroService_handlePostMacro(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.MacroService{
|
||||
CreateMacroF: func(ctx context.Context, m *platform.Macro) error {
|
||||
m.ID = platformtesting.MustIDFromString("0")
|
||||
m.ID = platformtesting.MustIDBase16("0")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -275,7 +275,7 @@ func TestMacroService_handlePostMacro(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.MacroService{
|
||||
CreateMacroF: func(ctx context.Context, m *platform.Macro) error {
|
||||
m.ID = platformtesting.MustIDFromString("0")
|
||||
m.ID = platformtesting.MustIDBase16("0")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -344,7 +344,7 @@ func TestMacroService_handlePatchMacro(t *testing.T) {
|
|||
&mock.MacroService{
|
||||
UpdateMacroF: func(ctx context.Context, id platform.ID, u *platform.MacroUpdate) (*platform.Macro, error) {
|
||||
return &platform.Macro{
|
||||
ID: platformtesting.MustIDFromString("75650d0a636f6d70"),
|
||||
ID: platformtesting.MustIDBase16("75650d0a636f6d70"),
|
||||
Name: "new-name",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
return []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("7365637465747572"),
|
||||
ID: platformtesting.MustIDBase16("7365637465747572"),
|
||||
Name: "hello",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -53,7 +53,7 @@ func TestService_handleGetViews(t *testing.T) {
|
|||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("6167697474697320"),
|
||||
ID: platformtesting.MustIDBase16("6167697474697320"),
|
||||
Name: "example",
|
||||
},
|
||||
},
|
||||
|
|
@ -187,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: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
}, nil
|
||||
|
|
@ -294,7 +294,7 @@ func TestService_handlePostViews(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
CreateViewF: func(ctx context.Context, c *platform.View) error {
|
||||
c.ID = platformtesting.MustIDFromString("020f755c3c082000")
|
||||
c.ID = platformtesting.MustIDBase16("020f755c3c082000")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
|
@ -302,7 +302,7 @@ func TestService_handlePostViews(t *testing.T) {
|
|||
args: args{
|
||||
view: &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "hello",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -390,7 +390,7 @@ func TestService_handleDeleteView(t *testing.T) {
|
|||
fields: fields{
|
||||
&mock.ViewService{
|
||||
DeleteViewF: func(ctx context.Context, id platform.ID) error {
|
||||
if id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -487,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 id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
@ -534,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 id == platformtesting.MustIDFromString("020f755c3c082000") {
|
||||
if id == platformtesting.MustIDBase16("020f755c3c082000") {
|
||||
return &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
Name: "example",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ func TestIDFromString(t *testing.T) {
|
|||
{
|
||||
name: "Should be able to decode an all f ID",
|
||||
id: "ffffffffffffffff",
|
||||
want: platformtesting.MustIDFromString("ffffffffffffffff"),
|
||||
want: platformtesting.MustIDBase16("ffffffffffffffff"),
|
||||
},
|
||||
{
|
||||
name: "Should be able to decode an ID",
|
||||
id: "020f755c3c082000",
|
||||
want: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
want: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
},
|
||||
{
|
||||
name: "Should not be able to decode a non hex ID",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func TestMacro_UnmarshalJSON(t *testing.T) {
|
|||
}
|
||||
`,
|
||||
want: platform.Macro{
|
||||
ID: platformtesting.MustIDFromString(macroTestID),
|
||||
ID: platformtesting.MustIDBase16(macroTestID),
|
||||
Name: "howdy",
|
||||
Selected: make([]string, 0),
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -57,7 +57,7 @@ func TestMacro_UnmarshalJSON(t *testing.T) {
|
|||
}
|
||||
`,
|
||||
want: platform.Macro{
|
||||
ID: platformtesting.MustIDFromString(macroTestID),
|
||||
ID: platformtesting.MustIDBase16(macroTestID),
|
||||
Name: "howdy",
|
||||
Selected: make([]string, 0),
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -83,7 +83,7 @@ func TestMacro_UnmarshalJSON(t *testing.T) {
|
|||
}
|
||||
`,
|
||||
want: platform.Macro{
|
||||
ID: platformtesting.MustIDFromString(macroTestID),
|
||||
ID: platformtesting.MustIDBase16(macroTestID),
|
||||
Name: "howdy",
|
||||
Selected: make([]string, 0),
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ func init() {
|
|||
Database: "db",
|
||||
RetentionPolicy: "rp",
|
||||
Default: true,
|
||||
OrganizationID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
BucketID: platformtesting.MustIDFromString("bbbbbbbbbbbbbbbb"),
|
||||
OrganizationID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
BucketID: platformtesting.MustIDBase16("bbbbbbbbbbbbbbbb"),
|
||||
}
|
||||
dbrpMappingSvc.FindByFn = func(ctx context.Context, cluster string, db string, rp string) (*platform.DBRPMapping, error) {
|
||||
return &mapping, nil
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ func init() {
|
|||
Database: "db0",
|
||||
RetentionPolicy: "autogen",
|
||||
Default: true,
|
||||
OrganizationID: platformtesting.MustIDFromString("cadecadecadecade"),
|
||||
BucketID: platformtesting.MustIDFromString("da7aba5e5eedca5e"),
|
||||
OrganizationID: platformtesting.MustIDBase16("cadecadecadecade"),
|
||||
BucketID: platformtesting.MustIDBase16("da7aba5e5eedca5e"),
|
||||
}
|
||||
dbrpMappingSvc.FindByFn = func(ctx context.Context, cluster string, db string, rp string) (*platform.DBRPMapping, error) {
|
||||
return &mapping, nil
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ func NewFixture(stmt string, spec *flux.Spec) Fixture {
|
|||
}
|
||||
|
||||
func (f *fixture) Run(t *testing.T) {
|
||||
organizationID = platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa")
|
||||
bucketID = platformtesting.MustIDFromString("bbbbbbbbbbbbbbbb")
|
||||
altBucketID = platformtesting.MustIDFromString("cccccccccccccccc")
|
||||
organizationID = platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa")
|
||||
bucketID = platformtesting.MustIDBase16("bbbbbbbbbbbbbbbb")
|
||||
altBucketID = platformtesting.MustIDBase16("cccccccccccccccc")
|
||||
|
||||
t.Run(f.stmt, func(t *testing.T) {
|
||||
if err := f.spec.Validate(); err != nil {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ func init() {
|
|||
Database: "db0",
|
||||
RetentionPolicy: "autogen",
|
||||
Default: true,
|
||||
OrganizationID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
BucketID: platformtesting.MustIDFromString("bbbbbbbbbbbbbbbb"),
|
||||
OrganizationID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
BucketID: platformtesting.MustIDBase16("bbbbbbbbbbbbbbbb"),
|
||||
}
|
||||
dbrpMappingSvc.FindByFn = func(ctx context.Context, cluster string, db string, rp string) (*platform.DBRPMapping, error) {
|
||||
return &mapping, nil
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ func TestRequest_JSON(t *testing.T) {
|
|||
name: "simple",
|
||||
data: `{"organization_id":"aaaaaaaaaaaaaaaa","compiler":{"a":"my custom compiler"},"compiler_type":"compilerA"}`,
|
||||
want: query.Request{
|
||||
OrganizationID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
OrganizationID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
Compiler: &compilerA{
|
||||
A: "my custom compiler",
|
||||
},
|
||||
|
|
@ -97,7 +97,7 @@ func TestProxyRequest_JSON(t *testing.T) {
|
|||
data: `{"request":{"organization_id":"aaaaaaaaaaaaaaaa","compiler":{"a":"my custom compiler"},"compiler_type":"compilerA"},"dialect":{"b":42},"dialect_type":"dialectB"}`,
|
||||
want: query.ProxyRequest{
|
||||
Request: query.Request{
|
||||
OrganizationID: platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa"),
|
||||
OrganizationID: platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa"),
|
||||
Compiler: &compilerA{
|
||||
A: "my custom compiler",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ func TestCoordinator(t *testing.T) {
|
|||
createChan := sched.TaskCreateChan()
|
||||
releaseChan := sched.TaskReleaseChan()
|
||||
|
||||
orgID := platformtesting.MustIDFromString("69746f7175650d0a")
|
||||
usrID := platformtesting.MustIDFromString("6c61757320657420")
|
||||
orgID := platformtesting.MustIDBase16("69746f7175650d0a")
|
||||
usrID := platformtesting.MustIDBase16("6c61757320657420")
|
||||
script := `option task = {name: "a task",cron: "* * * * *"} from(bucket:"test") |> range(start:-1h)`
|
||||
id, err := coord.CreateTask(context.Background(), orgID, usrID, script, 0)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -251,8 +251,8 @@ const testScript = `option task = {
|
|||
from(bucket: "one") |> toHTTP(url: "http://example.com")`
|
||||
|
||||
func testExecutorQuerySuccess(t *testing.T, fn createSysFn) {
|
||||
var orgID = platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDFromString("baaaaaaaaaaaaaab")
|
||||
var orgID = platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDBase16("baaaaaaaaaaaaaab")
|
||||
sys := fn()
|
||||
t.Run(sys.name+"/QuerySuccess", func(t *testing.T) {
|
||||
tid, err := sys.st.CreateTask(context.Background(), orgID, userID, testScript, 0)
|
||||
|
|
@ -303,8 +303,8 @@ func testExecutorQuerySuccess(t *testing.T, fn createSysFn) {
|
|||
}
|
||||
|
||||
func testExecutorQueryFailure(t *testing.T, fn createSysFn) {
|
||||
var orgID = platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDFromString("baaaaaaaaaaaaaab")
|
||||
var orgID = platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDBase16("baaaaaaaaaaaaaab")
|
||||
sys := fn()
|
||||
t.Run(sys.name+"/QueryFail", func(t *testing.T) {
|
||||
tid, err := sys.st.CreateTask(context.Background(), orgID, userID, testScript, 0)
|
||||
|
|
@ -331,8 +331,8 @@ func testExecutorQueryFailure(t *testing.T, fn createSysFn) {
|
|||
}
|
||||
|
||||
func testExecutorPromiseCancel(t *testing.T, fn createSysFn) {
|
||||
var orgID = platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDFromString("baaaaaaaaaaaaaab")
|
||||
var orgID = platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDBase16("baaaaaaaaaaaaaab")
|
||||
sys := fn()
|
||||
t.Run(sys.name+"/PromiseCancel", func(t *testing.T) {
|
||||
tid, err := sys.st.CreateTask(context.Background(), orgID, userID, testScript, 0)
|
||||
|
|
@ -358,8 +358,8 @@ func testExecutorPromiseCancel(t *testing.T, fn createSysFn) {
|
|||
}
|
||||
|
||||
func testExecutorServiceError(t *testing.T, fn createSysFn) {
|
||||
var orgID = platformtesting.MustIDFromString("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDFromString("baaaaaaaaaaaaaab")
|
||||
var orgID = platformtesting.MustIDBase16("aaaaaaaaaaaaaaaa")
|
||||
var userID = platformtesting.MustIDBase16("baaaaaaaaaaaaaab")
|
||||
sys := fn()
|
||||
t.Run(sys.name+"/ServiceError", func(t *testing.T) {
|
||||
tid, err := sys.st.CreateTask(context.Background(), orgID, userID, testScript, 0)
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ func updateRunState(t *testing.T, crf CreateRunStoreFunc, drf DestroyRunStoreFun
|
|||
defer drf(t, writer, reader)
|
||||
|
||||
task := &backend.StoreTask{
|
||||
ID: platformtesting.MustIDFromString("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDFromString("ab01ab01ab01ab05"),
|
||||
ID: platformtesting.MustIDBase16("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDBase16("ab01ab01ab01ab05"),
|
||||
}
|
||||
scheduledFor := time.Unix(1, 0).UTC()
|
||||
run := platform.Run{
|
||||
ID: platformtesting.MustIDFromString("2c20766972747573"),
|
||||
ID: platformtesting.MustIDBase16("2c20766972747573"),
|
||||
TaskID: task.ID,
|
||||
Status: "started",
|
||||
ScheduledFor: scheduledFor.Format(time.RFC3339),
|
||||
|
|
@ -97,14 +97,14 @@ func runLogTest(t *testing.T, crf CreateRunStoreFunc, drf DestroyRunStoreFunc) {
|
|||
defer drf(t, writer, reader)
|
||||
|
||||
task := &backend.StoreTask{
|
||||
ID: platformtesting.MustIDFromString("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDFromString("ab01ab01ab01ab05"),
|
||||
ID: platformtesting.MustIDBase16("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDBase16("ab01ab01ab01ab05"),
|
||||
}
|
||||
|
||||
sf := time.Now().UTC()
|
||||
sa := sf.Add(time.Second)
|
||||
run := platform.Run{
|
||||
ID: platformtesting.MustIDFromString("2c20766972747573"),
|
||||
ID: platformtesting.MustIDBase16("2c20766972747573"),
|
||||
TaskID: task.ID,
|
||||
Status: "started",
|
||||
ScheduledFor: sf.Format(time.RFC3339),
|
||||
|
|
@ -155,8 +155,8 @@ func listRunsTest(t *testing.T, crf CreateRunStoreFunc, drf DestroyRunStoreFunc)
|
|||
defer drf(t, writer, reader)
|
||||
|
||||
task := &backend.StoreTask{
|
||||
ID: platformtesting.MustIDFromString("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDFromString("ab01ab01ab01ab05"),
|
||||
ID: platformtesting.MustIDBase16("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDBase16("ab01ab01ab01ab05"),
|
||||
}
|
||||
|
||||
if _, err := reader.ListRuns(context.Background(), platform.RunFilter{Task: &task.ID}); err == nil {
|
||||
|
|
@ -260,14 +260,14 @@ func findRunByIDTest(t *testing.T, crf CreateRunStoreFunc, drf DestroyRunStoreFu
|
|||
}
|
||||
|
||||
task := &backend.StoreTask{
|
||||
ID: platformtesting.MustIDFromString("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDFromString("ab01ab01ab01ab05"),
|
||||
ID: platformtesting.MustIDBase16("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDBase16("ab01ab01ab01ab05"),
|
||||
}
|
||||
sf := time.Now().UTC()
|
||||
sa := sf.Add(time.Second)
|
||||
|
||||
run := platform.Run{
|
||||
ID: platformtesting.MustIDFromString("2c20766972747573"),
|
||||
ID: platformtesting.MustIDBase16("2c20766972747573"),
|
||||
TaskID: task.ID,
|
||||
Status: "started",
|
||||
ScheduledFor: sf.Format(time.RFC3339),
|
||||
|
|
@ -309,8 +309,8 @@ func listLogsTest(t *testing.T, crf CreateRunStoreFunc, drf DestroyRunStoreFunc)
|
|||
defer drf(t, writer, reader)
|
||||
|
||||
task := &backend.StoreTask{
|
||||
ID: platformtesting.MustIDFromString("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDFromString("ab01ab01ab01ab05"),
|
||||
ID: platformtesting.MustIDBase16("ab01ab01ab01ab01"),
|
||||
Org: platformtesting.MustIDBase16("ab01ab01ab01ab05"),
|
||||
}
|
||||
|
||||
if _, err := reader.ListLogs(context.Background(), platform.LogFilter{}); err == nil {
|
||||
|
|
|
|||
178
testing/auth.go
178
testing/auth.go
|
|
@ -110,13 +110,13 @@ func CreateAuthorization(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
authorization: &platform.Authorization{
|
||||
ID: MustIDFromString(authOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
User: "cooluser",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -127,8 +127,8 @@ func CreateAuthorization(
|
|||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand",
|
||||
Status: platform.Active,
|
||||
User: "cooluser",
|
||||
|
|
@ -152,17 +152,17 @@ func CreateAuthorization(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "supersecret",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -174,7 +174,7 @@ func CreateAuthorization(
|
|||
args: args{
|
||||
authorization: &platform.Authorization{
|
||||
User: "regularuser",
|
||||
ID: MustIDFromString(authTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
},
|
||||
|
|
@ -183,8 +183,8 @@ func CreateAuthorization(
|
|||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
User: "cooluser",
|
||||
Status: platform.Active,
|
||||
Token: "supersecret",
|
||||
|
|
@ -194,8 +194,8 @@ func CreateAuthorization(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Token: "rand",
|
||||
Status: platform.Active,
|
||||
|
|
@ -263,17 +263,17 @@ func FindAuthorizationByID(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -281,8 +281,8 @@ func FindAuthorizationByID(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -291,12 +291,12 @@ func FindAuthorizationByID(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(authTwoID),
|
||||
id: MustIDBase16(authTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
authorization: &platform.Authorization{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Status: platform.Active,
|
||||
Token: "rand2",
|
||||
|
|
@ -357,17 +357,17 @@ func FindAuthorizationByToken(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Status: platform.Inactive,
|
||||
Permissions: []platform.Permission{
|
||||
|
|
@ -376,8 +376,8 @@ func FindAuthorizationByToken(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authZeroID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authZeroID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand0",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -385,16 +385,16 @@ func FindAuthorizationByToken(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authThreeID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authThreeID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand3",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -408,8 +408,8 @@ func FindAuthorizationByToken(
|
|||
},
|
||||
wants: wants{
|
||||
authorization: &platform.Authorization{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Status: platform.Inactive,
|
||||
User: "cooluser",
|
||||
Token: "rand1",
|
||||
|
|
@ -473,17 +473,17 @@ func FindAuthorizations(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -491,8 +491,8 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -504,8 +504,8 @@ func FindAuthorizations(
|
|||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
User: "cooluser",
|
||||
Token: "rand1",
|
||||
Status: platform.Active,
|
||||
|
|
@ -515,8 +515,8 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Token: "rand2",
|
||||
Status: platform.Active,
|
||||
|
|
@ -533,17 +533,17 @@ func FindAuthorizations(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Status: platform.Active,
|
||||
Permissions: []platform.Permission{
|
||||
|
|
@ -552,16 +552,16 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authThreeID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authThreeID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand3",
|
||||
Permissions: []platform.Permission{
|
||||
platform.DeleteUserPermission,
|
||||
|
|
@ -570,13 +570,13 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
UserID: MustIDFromString(userOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
},
|
||||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
User: "cooluser",
|
||||
Status: platform.Active,
|
||||
Token: "rand1",
|
||||
|
|
@ -586,8 +586,8 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authThreeID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authThreeID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
User: "cooluser",
|
||||
Status: platform.Active,
|
||||
Token: "rand3",
|
||||
|
|
@ -604,25 +604,25 @@ func FindAuthorizations(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authZeroID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authZeroID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.DeleteUserPermission,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -630,16 +630,16 @@ func FindAuthorizations(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authThreeID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authThreeID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand3",
|
||||
Permissions: []platform.Permission{
|
||||
platform.DeleteUserPermission,
|
||||
|
|
@ -653,8 +653,8 @@ func FindAuthorizations(
|
|||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Token: "rand2",
|
||||
Status: platform.Active,
|
||||
|
|
@ -727,17 +727,17 @@ func DeleteAuthorization(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -745,8 +745,8 @@ func DeleteAuthorization(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -755,13 +755,13 @@ func DeleteAuthorization(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(authOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
},
|
||||
wants: wants{
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Status: platform.Active,
|
||||
Token: "rand2",
|
||||
|
|
@ -778,17 +778,17 @@ func DeleteAuthorization(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "cooluser",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "regularuser",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
Authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
Token: "rand1",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -796,8 +796,8 @@ func DeleteAuthorization(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
Token: "rand2",
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
|
|
@ -806,14 +806,14 @@ func DeleteAuthorization(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(authThreeID),
|
||||
ID: MustIDBase16(authThreeID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("authorization not found"),
|
||||
authorizations: []*platform.Authorization{
|
||||
{
|
||||
ID: MustIDFromString(authOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(authOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
User: "cooluser",
|
||||
Token: "rand1",
|
||||
Status: platform.Active,
|
||||
|
|
@ -823,8 +823,8 @@ func DeleteAuthorization(
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(authTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(authTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
User: "regularuser",
|
||||
Token: "rand2",
|
||||
Status: platform.Active,
|
||||
|
|
|
|||
|
|
@ -112,22 +112,22 @@ func CreateBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "name1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
},
|
||||
},
|
||||
|
|
@ -138,46 +138,46 @@ func CreateBucket(
|
|||
fields: BucketFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(bucketTwoID)
|
||||
return MustIDBase16(bucketTwoID)
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "bucket2",
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
Organization: "theorg",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
Name: "bucket2",
|
||||
Organization: "otherorg",
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -187,24 +187,24 @@ func CreateBucket(
|
|||
fields: BucketFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(bucketTwoID)
|
||||
return MustIDBase16(bucketTwoID)
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -217,16 +217,16 @@ func CreateBucket(
|
|||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
Organization: "theorg",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
Name: "bucket2",
|
||||
Organization: "otherorg",
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -236,40 +236,40 @@ func CreateBucket(
|
|||
fields: BucketFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(bucketTwoID)
|
||||
return MustIDBase16(bucketTwoID)
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
Organization: "theorg",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
err: fmt.Errorf("bucket with name bucket1 already exists"),
|
||||
|
|
@ -280,46 +280,46 @@ func CreateBucket(
|
|||
fields: BucketFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(bucketTwoID)
|
||||
return MustIDBase16(bucketTwoID)
|
||||
},
|
||||
},
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
bucket: &platform.Bucket{
|
||||
Name: "bucket1",
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
Name: "bucket1",
|
||||
Organization: "theorg",
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
Name: "bucket1",
|
||||
Organization: "otherorg",
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -385,30 +385,30 @@ func FindBucketByID(
|
|||
fields: BucketFields{
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket2",
|
||||
},
|
||||
},
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(bucketTwoID),
|
||||
id: MustIDBase16(bucketTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "bucket2",
|
||||
},
|
||||
|
|
@ -468,22 +468,22 @@ func FindBuckets(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -492,14 +492,14 @@ func FindBuckets(
|
|||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
Organization: "otherorg",
|
||||
Name: "xyz",
|
||||
},
|
||||
|
|
@ -512,27 +512,27 @@ func FindBuckets(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "123",
|
||||
},
|
||||
},
|
||||
|
|
@ -543,14 +543,14 @@ func FindBuckets(
|
|||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "123",
|
||||
},
|
||||
|
|
@ -563,45 +563,45 @@ func FindBuckets(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "otherorg",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "123",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
organizationID: MustIDFromString(orgOneID),
|
||||
organizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "123",
|
||||
},
|
||||
|
|
@ -614,30 +614,30 @@ func FindBuckets(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "xyz",
|
||||
},
|
||||
|
|
@ -650,18 +650,18 @@ func FindBuckets(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -672,8 +672,8 @@ func FindBuckets(
|
|||
wants: wants{
|
||||
buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "xyz",
|
||||
},
|
||||
|
|
@ -745,19 +745,19 @@ func DeleteBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -768,8 +768,8 @@ func DeleteBucket(
|
|||
buckets: []*platform.Bucket{
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
},
|
||||
},
|
||||
|
|
@ -781,19 +781,19 @@ func DeleteBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -805,14 +805,14 @@ func DeleteBucket(
|
|||
buckets: []*platform.Bucket{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(bucketThreeID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketThreeID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
},
|
||||
},
|
||||
|
|
@ -825,7 +825,7 @@ func DeleteBucket(
|
|||
s, done := init(tt.fields, t)
|
||||
defer done()
|
||||
ctx := context.TODO()
|
||||
err := s.DeleteBucket(ctx, MustIDFromString(tt.args.ID))
|
||||
err := s.DeleteBucket(ctx, MustIDBase16(tt.args.ID))
|
||||
if (err != nil) != (tt.wants.err != nil) {
|
||||
t.Fatalf("expected error '%v' got '%v'", tt.wants.err, err)
|
||||
}
|
||||
|
|
@ -875,30 +875,30 @@ func FindBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
name: "abc",
|
||||
organizationID: MustIDFromString(orgOneID),
|
||||
organizationID: MustIDBase16(orgOneID),
|
||||
},
|
||||
wants: wants{
|
||||
bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "abc",
|
||||
},
|
||||
|
|
@ -964,30 +964,30 @@ func UpdateBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(bucketOneID),
|
||||
id: MustIDBase16(bucketOneID),
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "changed",
|
||||
},
|
||||
|
|
@ -999,30 +999,30 @@ func UpdateBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(bucketOneID),
|
||||
id: MustIDBase16(bucketOneID),
|
||||
retention: 100,
|
||||
},
|
||||
wants: wants{
|
||||
bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "bucket1",
|
||||
RetentionPeriod: 100 * time.Minute,
|
||||
|
|
@ -1035,31 +1035,31 @@ func UpdateBucket(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "theorg",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
Buckets: []*platform.Bucket{
|
||||
{
|
||||
ID: MustIDFromString(bucketOneID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketOneID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Name: "bucket2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(bucketTwoID),
|
||||
id: MustIDBase16(bucketTwoID),
|
||||
retention: 101,
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(bucketTwoID),
|
||||
OrganizationID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(bucketTwoID),
|
||||
OrganizationID: MustIDBase16(orgOneID),
|
||||
Organization: "theorg",
|
||||
Name: "changed",
|
||||
RetentionPeriod: 101 * time.Minute,
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ func CreateView(
|
|||
fields: ViewFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(viewTwoID)
|
||||
return MustIDBase16(viewTwoID)
|
||||
},
|
||||
},
|
||||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
},
|
||||
|
|
@ -88,14 +88,14 @@ func CreateView(
|
|||
views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -161,14 +161,14 @@ func FindViewByID(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -179,12 +179,12 @@ func FindViewByID(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(viewTwoID),
|
||||
id: MustIDBase16(viewTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
view: &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -246,14 +246,14 @@ func FindViews(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -268,14 +268,14 @@ func FindViews(
|
|||
views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -292,14 +292,14 @@ func FindViews(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -310,13 +310,13 @@ func FindViews(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -383,14 +383,14 @@ func DeleteView(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -401,13 +401,13 @@ func DeleteView(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
},
|
||||
wants: wants{
|
||||
views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -424,14 +424,14 @@ func DeleteView(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -442,21 +442,21 @@ func DeleteView(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(viewThreeID),
|
||||
ID: MustIDBase16(viewThreeID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("View not found"),
|
||||
views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -524,14 +524,14 @@ func UpdateView(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -542,13 +542,13 @@ func UpdateView(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(viewOneID),
|
||||
id: MustIDBase16(viewOneID),
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
view: &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "changed",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
|
|
@ -561,14 +561,14 @@ func UpdateView(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.EmptyViewProperties{},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewTwoID),
|
||||
ID: MustIDBase16(viewTwoID),
|
||||
Name: "view2",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
@ -579,7 +579,7 @@ func UpdateView(
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(viewOneID),
|
||||
id: MustIDBase16(viewOneID),
|
||||
properties: platform.TableViewProperties{
|
||||
Type: "table",
|
||||
TimeFormat: "rfc3339",
|
||||
|
|
@ -588,7 +588,7 @@ func UpdateView(
|
|||
wants: wants{
|
||||
view: &platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(viewOneID),
|
||||
ID: MustIDBase16(viewOneID),
|
||||
Name: "view1",
|
||||
},
|
||||
Properties: platform.TableViewProperties{
|
||||
|
|
|
|||
|
|
@ -115,30 +115,30 @@ func CreateDashboard(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboard: &platform.Dashboard{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "dashboard2",
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "dashboard2",
|
||||
},
|
||||
},
|
||||
|
|
@ -199,39 +199,39 @@ func AddDashboardCell(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
},
|
||||
},
|
||||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cell: &platform.Cell{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -292,21 +292,21 @@ func FindDashboardByID(
|
|||
fields: DashboardFields{
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "dashboard2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(dashTwoID),
|
||||
id: MustIDBase16(dashTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
dashboard: &platform.Dashboard{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "dashboard2",
|
||||
},
|
||||
},
|
||||
|
|
@ -362,11 +362,11 @@ func FindDashboards(
|
|||
fields: DashboardFields{
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -375,11 +375,11 @@ func FindDashboards(
|
|||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -390,24 +390,24 @@ func FindDashboards(
|
|||
fields: DashboardFields{
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
IDs: []*platform.ID{
|
||||
idPtr(MustIDFromString(dashTwoID)),
|
||||
idPtr(MustIDBase16(dashTwoID)),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -418,29 +418,29 @@ func FindDashboards(
|
|||
fields: DashboardFields{
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
IDs: []*platform.ID{
|
||||
idPtr(MustIDFromString(dashOneID)),
|
||||
idPtr(MustIDFromString(dashTwoID)),
|
||||
idPtr(MustIDBase16(dashOneID)),
|
||||
idPtr(MustIDBase16(dashTwoID)),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -502,22 +502,22 @@ func DeleteDashboard(
|
|||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -528,27 +528,27 @@ func DeleteDashboard(
|
|||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(dashThreeID),
|
||||
ID: MustIDBase16(dashThreeID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("dashboard not found"),
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
Name: "A",
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
{
|
||||
Name: "B",
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -609,22 +609,22 @@ func UpdateDashboard(
|
|||
fields: DashboardFields{
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
Name: "dashboard2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(dashOneID),
|
||||
id: MustIDBase16(dashOneID),
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
dashboard: &platform.Dashboard{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "changed",
|
||||
},
|
||||
},
|
||||
|
|
@ -685,21 +685,21 @@ func RemoveDashboardCell(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -707,24 +707,24 @@ func RemoveDashboardCell(
|
|||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
cellID: MustIDFromString(dashTwoID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cellID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -787,48 +787,48 @@ func UpdateDashboardCell(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
cellID: MustIDFromString(dashTwoID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cellID: MustIDBase16(dashTwoID),
|
||||
cellUpdate: platform.CellUpdate{
|
||||
X: func(i int32) *int32 { return &i }(int32(10)),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
X: 10,
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -890,49 +890,49 @@ func ReplaceDashboardCells(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
X: 10,
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
Y: 11,
|
||||
},
|
||||
},
|
||||
|
|
@ -940,17 +940,17 @@ func ReplaceDashboardCells(
|
|||
wants: wants{
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
X: 10,
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
Y: 11,
|
||||
},
|
||||
},
|
||||
|
|
@ -963,40 +963,40 @@ func ReplaceDashboardCells(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
X: 10,
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
Y: 11,
|
||||
},
|
||||
},
|
||||
|
|
@ -1005,12 +1005,12 @@ func ReplaceDashboardCells(
|
|||
err: fmt.Errorf("cannot replace cells that were not already present"),
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -1022,40 +1022,40 @@ func ReplaceDashboardCells(
|
|||
fields: DashboardFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(dashTwoID)
|
||||
return MustIDBase16(dashTwoID)
|
||||
},
|
||||
},
|
||||
Views: []*platform.View{
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
Dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
dashboardID: MustIDFromString(dashOneID),
|
||||
dashboardID: MustIDBase16(dashOneID),
|
||||
cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashOneID),
|
||||
X: 10,
|
||||
},
|
||||
},
|
||||
|
|
@ -1064,12 +1064,12 @@ func ReplaceDashboardCells(
|
|||
err: fmt.Errorf("cannot update view id in replace"),
|
||||
dashboards: []*platform.Dashboard{
|
||||
{
|
||||
ID: MustIDFromString(dashOneID),
|
||||
ID: MustIDBase16(dashOneID),
|
||||
Name: "dashboard1",
|
||||
Cells: []*platform.Cell{
|
||||
{
|
||||
ID: MustIDFromString(dashTwoID),
|
||||
ViewID: MustIDFromString(dashTwoID),
|
||||
ID: MustIDBase16(dashTwoID),
|
||||
ViewID: MustIDBase16(dashTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -111,8 +111,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
|
@ -124,8 +124,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
}},
|
||||
},
|
||||
args: args{
|
||||
|
|
@ -134,8 +134,8 @@ func CreateDBRPMapping(
|
|||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -145,16 +145,16 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -167,8 +167,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
}},
|
||||
},
|
||||
args: args{
|
||||
|
|
@ -177,8 +177,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -188,8 +188,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -202,8 +202,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
}},
|
||||
},
|
||||
args: args{
|
||||
|
|
@ -212,8 +212,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -224,8 +224,8 @@ func CreateDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -287,16 +287,16 @@ func FindDBRPMappings(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -310,16 +310,16 @@ func FindDBRPMappings(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -333,16 +333,16 @@ func FindDBRPMappings(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -358,8 +358,8 @@ func FindDBRPMappings(
|
|||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -373,16 +373,16 @@ func FindDBRPMappings(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyA",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketAID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketAID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster",
|
||||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -400,8 +400,8 @@ func FindDBRPMappings(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -463,16 +463,16 @@ func FindDBRPMappingByKey(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyA",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketAID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketAID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster",
|
||||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -487,8 +487,8 @@ func FindDBRPMappingByKey(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -501,8 +501,8 @@ func FindDBRPMappingByKey(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyA",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketAID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketAID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -570,16 +570,16 @@ func FindDBRPMapping(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyA",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketAID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketAID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster",
|
||||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -596,8 +596,8 @@ func FindDBRPMapping(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -610,16 +610,16 @@ func FindDBRPMapping(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyA",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketAID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketAID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster",
|
||||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -636,8 +636,8 @@ func FindDBRPMapping(
|
|||
Database: "database",
|
||||
RetentionPolicy: "retention_policyB",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg3ID),
|
||||
BucketID: MustIDFromString(dbrpBucketBID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg3ID),
|
||||
BucketID: MustIDBase16(dbrpBucketBID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -695,16 +695,16 @@ func DeleteDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -719,8 +719,8 @@ func DeleteDBRPMapping(
|
|||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
|
@ -733,16 +733,16 @@ func DeleteDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -758,16 +758,16 @@ func DeleteDBRPMapping(
|
|||
Database: "database1",
|
||||
RetentionPolicy: "retention_policy1",
|
||||
Default: false,
|
||||
OrganizationID: MustIDFromString(dbrpOrg1ID),
|
||||
BucketID: MustIDFromString(dbrpBucket1ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg1ID),
|
||||
BucketID: MustIDBase16(dbrpBucket1ID),
|
||||
},
|
||||
{
|
||||
Cluster: "cluster2",
|
||||
Database: "database2",
|
||||
RetentionPolicy: "retention_policy2",
|
||||
Default: true,
|
||||
OrganizationID: MustIDFromString(dbrpOrg2ID),
|
||||
BucketID: MustIDFromString(dbrpBucket2ID),
|
||||
OrganizationID: MustIDBase16(dbrpOrg2ID),
|
||||
BucketID: MustIDBase16(dbrpBucket2ID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -92,12 +92,12 @@ func CreateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
fields: MacroFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(idA)
|
||||
return MustIDBase16(idA)
|
||||
},
|
||||
},
|
||||
Macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "existing-macro",
|
||||
Selected: []string{"a"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -109,7 +109,7 @@ func CreateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
args: args{
|
||||
macro: &platform.Macro{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "my-macro",
|
||||
Selected: []string{"a"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -122,7 +122,7 @@ func CreateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
err: nil,
|
||||
macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "existing-macro",
|
||||
Selected: []string{"a"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -131,7 +131,7 @@ func CreateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "my-macro",
|
||||
Selected: []string{"a"},
|
||||
Arguments: &platform.MacroArguments{
|
||||
|
|
@ -183,7 +183,7 @@ func FindMacroByID(init func(MacroFields, *testing.T) (platform.MacroService, fu
|
|||
fields: MacroFields{
|
||||
Macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro-a",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -191,7 +191,7 @@ func FindMacroByID(init func(MacroFields, *testing.T) (platform.MacroService, fu
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "existing-macro-b",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -201,12 +201,12 @@ func FindMacroByID(init func(MacroFields, *testing.T) (platform.MacroService, fu
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idB),
|
||||
id: MustIDBase16(idB),
|
||||
},
|
||||
wants: wants{
|
||||
err: nil,
|
||||
macro: &platform.Macro{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "existing-macro-b",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -221,7 +221,7 @@ func FindMacroByID(init func(MacroFields, *testing.T) (platform.MacroService, fu
|
|||
Macros: []*platform.Macro{},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idA),
|
||||
id: MustIDBase16(idA),
|
||||
},
|
||||
wants: wants{
|
||||
err: kerrors.Errorf(kerrors.NotFound, "macro with ID %s not found", idA),
|
||||
|
|
@ -266,7 +266,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
fields: MacroFields{
|
||||
Macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro-a",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -274,7 +274,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "existing-macro-b",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -284,7 +284,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idB),
|
||||
id: MustIDBase16(idB),
|
||||
update: &platform.MacroUpdate{
|
||||
Name: "new-macro-b-name",
|
||||
},
|
||||
|
|
@ -293,7 +293,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
err: nil,
|
||||
macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro-a",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -301,7 +301,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(idB),
|
||||
ID: MustIDBase16(idB),
|
||||
Name: "new-macro-b-name",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -317,7 +317,7 @@ func UpdateMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
Macros: []*platform.Macro{},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idA),
|
||||
id: MustIDBase16(idA),
|
||||
update: &platform.MacroUpdate{
|
||||
Name: "howdy",
|
||||
},
|
||||
|
|
@ -376,7 +376,7 @@ func DeleteMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
fields: MacroFields{
|
||||
Macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -386,7 +386,7 @@ func DeleteMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idA),
|
||||
id: MustIDBase16(idA),
|
||||
},
|
||||
wants: wants{
|
||||
err: nil,
|
||||
|
|
@ -398,7 +398,7 @@ func DeleteMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
fields: MacroFields{
|
||||
Macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
@ -408,13 +408,13 @@ func DeleteMacro(init func(MacroFields, *testing.T) (platform.MacroService, func
|
|||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(idB),
|
||||
id: MustIDBase16(idB),
|
||||
},
|
||||
wants: wants{
|
||||
err: kerrors.Errorf(kerrors.NotFound, "macro with ID %s not found", idB),
|
||||
macros: []*platform.Macro{
|
||||
{
|
||||
ID: MustIDFromString(idA),
|
||||
ID: MustIDBase16(idA),
|
||||
Name: "existing-macro",
|
||||
Arguments: &platform.MacroArguments{
|
||||
Type: "constant",
|
||||
|
|
|
|||
|
|
@ -154,25 +154,25 @@ func Generate(
|
|||
password: "pass1",
|
||||
results: &platform.OnboardingResults{
|
||||
User: &platform.User{
|
||||
ID: MustIDFromString(oneID),
|
||||
ID: MustIDBase16(oneID),
|
||||
Name: "admin",
|
||||
},
|
||||
Org: &platform.Organization{
|
||||
ID: MustIDFromString(twoID),
|
||||
ID: MustIDBase16(twoID),
|
||||
Name: "org1",
|
||||
},
|
||||
Bucket: &platform.Bucket{
|
||||
ID: MustIDFromString(threeID),
|
||||
ID: MustIDBase16(threeID),
|
||||
Name: "bucket1",
|
||||
Organization: "org1",
|
||||
OrganizationID: MustIDFromString(twoID),
|
||||
OrganizationID: MustIDBase16(twoID),
|
||||
},
|
||||
Auth: &platform.Authorization{
|
||||
ID: MustIDFromString(fourID),
|
||||
ID: MustIDBase16(fourID),
|
||||
Token: oneToken,
|
||||
Status: platform.Active,
|
||||
User: "admin",
|
||||
UserID: MustIDFromString(oneID),
|
||||
UserID: MustIDBase16(oneID),
|
||||
Permissions: []platform.Permission{
|
||||
platform.CreateUserPermission,
|
||||
platform.DeleteUserPermission,
|
||||
|
|
@ -180,7 +180,7 @@ func Generate(
|
|||
Resource: platform.OrganizationResource,
|
||||
Action: platform.WriteAction,
|
||||
},
|
||||
platform.WriteBucketPermission(MustIDFromString(threeID)),
|
||||
platform.WriteBucketPermission(MustIDBase16(threeID)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -231,7 +231,7 @@ func (g *loopIDGenerator) ID() platform.ID {
|
|||
if g.p == len(g.s) {
|
||||
g.p = 0
|
||||
}
|
||||
id := MustIDFromString(g.s[g.p])
|
||||
id := MustIDBase16(g.s[g.p])
|
||||
g.p++
|
||||
return id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,14 +105,14 @@ func CreateOrganization(
|
|||
args: args{
|
||||
organization: &platform.Organization{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -123,25 +123,25 @@ func CreateOrganization(
|
|||
IDGenerator: mock.NewIDGenerator(orgTwoID, t),
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
organization: &platform.Organization{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "organization2",
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "organization2",
|
||||
},
|
||||
},
|
||||
|
|
@ -153,21 +153,21 @@ func CreateOrganization(
|
|||
IDGenerator: mock.NewIDGenerator(orgTwoID, t),
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
organization: &platform.Organization{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
},
|
||||
|
|
@ -232,21 +232,21 @@ func FindOrganizationByID(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "organization2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(orgTwoID),
|
||||
id: MustIDBase16(orgTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
organization: &platform.Organization{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "organization2",
|
||||
},
|
||||
},
|
||||
|
|
@ -302,11 +302,11 @@ func FindOrganizations(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -315,11 +315,11 @@ func FindOrganizations(
|
|||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -330,22 +330,22 @@ func FindOrganizations(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -356,11 +356,11 @@ func FindOrganizations(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -371,7 +371,7 @@ func FindOrganizations(
|
|||
wants: wants{
|
||||
organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -436,11 +436,11 @@ func DeleteOrganization(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -451,7 +451,7 @@ func DeleteOrganization(
|
|||
organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -462,11 +462,11 @@ func DeleteOrganization(
|
|||
Organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -478,11 +478,11 @@ func DeleteOrganization(
|
|||
organizations: []*platform.Organization{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -494,7 +494,7 @@ func DeleteOrganization(
|
|||
s, done := init(tt.fields, t)
|
||||
defer done()
|
||||
ctx := context.TODO()
|
||||
err := s.DeleteOrganization(ctx, MustIDFromString(tt.args.ID))
|
||||
err := s.DeleteOrganization(ctx, MustIDBase16(tt.args.ID))
|
||||
if (err != nil) != (tt.wants.err != nil) {
|
||||
t.Fatalf("expected error '%v' got '%v'", tt.wants.err, err)
|
||||
}
|
||||
|
|
@ -542,11 +542,11 @@ func FindOrganization(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -556,7 +556,7 @@ func FindOrganization(
|
|||
},
|
||||
wants: wants{
|
||||
organization: &platform.Organization{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
},
|
||||
|
|
@ -616,22 +616,22 @@ func UpdateOrganization(
|
|||
fields: OrganizationFields{
|
||||
Organizations: []*platform.Organization{
|
||||
{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "organization1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(orgTwoID),
|
||||
ID: MustIDBase16(orgTwoID),
|
||||
Name: "organization2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(orgOneID),
|
||||
id: MustIDBase16(orgOneID),
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
organization: &platform.Organization{
|
||||
ID: MustIDFromString(orgOneID),
|
||||
ID: MustIDBase16(orgOneID),
|
||||
Name: "changed",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ func AddTarget(
|
|||
OrgName: "org1",
|
||||
BucketName: "bucket1",
|
||||
URL: "url1",
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -95,7 +95,7 @@ func AddTarget(
|
|||
OrgName: "org1",
|
||||
BucketName: "bucket1",
|
||||
URL: "url1",
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -116,7 +116,7 @@ func AddTarget(
|
|||
OrgName: "org1",
|
||||
BucketName: "bucket1",
|
||||
URL: "url1",
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
Name: "name2",
|
||||
|
|
@ -124,7 +124,7 @@ func AddTarget(
|
|||
OrgName: "org2",
|
||||
BucketName: "bucket2",
|
||||
URL: "url2",
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -185,7 +185,7 @@ func ListTargets(
|
|||
OrgName: "org1",
|
||||
BucketName: "bucket1",
|
||||
URL: "url1",
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
Name: "name2",
|
||||
|
|
@ -193,7 +193,7 @@ func ListTargets(
|
|||
OrgName: "org2",
|
||||
BucketName: "bucket2",
|
||||
URL: "url2",
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -205,7 +205,7 @@ func ListTargets(
|
|||
OrgName: "org1",
|
||||
BucketName: "bucket1",
|
||||
URL: "url1",
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
Name: "name2",
|
||||
|
|
@ -213,7 +213,7 @@ func ListTargets(
|
|||
OrgName: "org2",
|
||||
BucketName: "bucket2",
|
||||
URL: "url2",
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -266,21 +266,21 @@ func GetTargetByID(
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
Name: "target1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
Name: "target2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(targetTwoID),
|
||||
id: MustIDBase16(targetTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
target: &platform.ScraperTarget{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
Name: "target2",
|
||||
},
|
||||
},
|
||||
|
|
@ -332,20 +332,20 @@ func RemoveTarget(init func(TargetFields, *testing.T) (platform.ScraperTargetSto
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
wants: wants{
|
||||
targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -355,24 +355,24 @@ func RemoveTarget(init func(TargetFields, *testing.T) (platform.ScraperTargetSto
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(targetThreeID),
|
||||
ID: MustIDBase16(targetThreeID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("scraper target is not found"),
|
||||
targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -430,11 +430,11 @@ func UpdateTarget(
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
URL: "url1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
URL: "url2",
|
||||
},
|
||||
},
|
||||
|
|
@ -451,17 +451,17 @@ func UpdateTarget(
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
URL: "url1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
URL: "url2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(targetThreeID),
|
||||
id: MustIDBase16(targetThreeID),
|
||||
url: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
|
|
@ -473,22 +473,22 @@ func UpdateTarget(
|
|||
fields: TargetFields{
|
||||
Targets: []platform.ScraperTarget{
|
||||
{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
URL: "url1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(targetTwoID),
|
||||
ID: MustIDBase16(targetTwoID),
|
||||
URL: "url2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(targetOneID),
|
||||
id: MustIDBase16(targetOneID),
|
||||
url: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
target: &platform.ScraperTarget{
|
||||
ID: MustIDFromString(targetOneID),
|
||||
ID: MustIDBase16(targetOneID),
|
||||
URL: "changed",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ func CreateSession(
|
|||
TokenGenerator: mock.NewTokenGenerator("abc123xyz", nil),
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(sessionOneID),
|
||||
ID: MustIDBase16(sessionOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
},
|
||||
|
|
@ -107,8 +107,8 @@ func CreateSession(
|
|||
},
|
||||
wants: wants{
|
||||
session: &platform.Session{
|
||||
ID: MustIDFromString(sessionTwoID),
|
||||
UserID: MustIDFromString(sessionOneID),
|
||||
ID: MustIDBase16(sessionTwoID),
|
||||
UserID: MustIDBase16(sessionOneID),
|
||||
Key: "abc123xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -164,8 +164,8 @@ func FindSession(
|
|||
TokenGenerator: mock.NewTokenGenerator("abc123xyz", nil),
|
||||
Sessions: []*platform.Session{
|
||||
{
|
||||
ID: MustIDFromString(sessionOneID),
|
||||
UserID: MustIDFromString(sessionTwoID),
|
||||
ID: MustIDBase16(sessionOneID),
|
||||
UserID: MustIDBase16(sessionTwoID),
|
||||
Key: "abc123xyz",
|
||||
ExpiresAt: time.Date(2030, 9, 26, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
|
|
@ -176,8 +176,8 @@ func FindSession(
|
|||
},
|
||||
wants: wants{
|
||||
session: &platform.Session{
|
||||
ID: MustIDFromString(sessionOneID),
|
||||
UserID: MustIDFromString(sessionTwoID),
|
||||
ID: MustIDBase16(sessionOneID),
|
||||
UserID: MustIDBase16(sessionTwoID),
|
||||
Key: "abc123xyz",
|
||||
ExpiresAt: time.Date(2030, 9, 26, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
|
|
@ -235,8 +235,8 @@ func ExpireSession(
|
|||
TokenGenerator: mock.NewTokenGenerator("abc123xyz", nil),
|
||||
Sessions: []*platform.Session{
|
||||
{
|
||||
ID: MustIDFromString(sessionOneID),
|
||||
UserID: MustIDFromString(sessionTwoID),
|
||||
ID: MustIDBase16(sessionOneID),
|
||||
UserID: MustIDBase16(sessionTwoID),
|
||||
Key: "abc123xyz",
|
||||
ExpiresAt: time.Date(2030, 9, 26, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
|
|
@ -247,8 +247,8 @@ func ExpireSession(
|
|||
},
|
||||
wants: wants{
|
||||
session: &platform.Session{
|
||||
ID: MustIDFromString(sessionOneID),
|
||||
UserID: MustIDFromString(sessionTwoID),
|
||||
ID: MustIDBase16(sessionOneID),
|
||||
UserID: MustIDBase16(sessionTwoID),
|
||||
Key: "abc123xyz",
|
||||
ExpiresAt: time.Date(2030, 9, 26, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -75,14 +75,14 @@ func CreateSource(
|
|||
{
|
||||
Name: "autogen",
|
||||
Type: "self",
|
||||
ID: MustIDFromString(defaultSourceID),
|
||||
OrganizationID: MustIDFromString(defaultSourceOrganizationID),
|
||||
ID: MustIDBase16(defaultSourceID),
|
||||
OrganizationID: MustIDBase16(defaultSourceOrganizationID),
|
||||
Default: true,
|
||||
},
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -143,19 +143,19 @@ func FindSourceByID(
|
|||
Sources: []*platform.Source{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(sourceOneID),
|
||||
id: MustIDBase16(sourceOneID),
|
||||
},
|
||||
wants: wants{
|
||||
source: &platform.Source{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -166,14 +166,14 @@ func FindSourceByID(
|
|||
Sources: []*platform.Source{},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(defaultSourceID),
|
||||
id: MustIDBase16(defaultSourceID),
|
||||
},
|
||||
wants: wants{
|
||||
source: &platform.Source{
|
||||
Name: "autogen",
|
||||
Type: "self",
|
||||
ID: MustIDFromString(defaultSourceID),
|
||||
OrganizationID: MustIDFromString(defaultSourceOrganizationID),
|
||||
ID: MustIDBase16(defaultSourceID),
|
||||
OrganizationID: MustIDBase16(defaultSourceOrganizationID),
|
||||
Default: true,
|
||||
},
|
||||
},
|
||||
|
|
@ -229,13 +229,13 @@ func FindSources(
|
|||
Sources: []*platform.Source{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
{
|
||||
Name: "name2",
|
||||
ID: MustIDFromString(sourceTwoID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceTwoID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -245,19 +245,19 @@ func FindSources(
|
|||
{
|
||||
Name: "autogen",
|
||||
Type: "self",
|
||||
ID: MustIDFromString(defaultSourceID),
|
||||
OrganizationID: MustIDFromString(defaultSourceOrganizationID),
|
||||
ID: MustIDBase16(defaultSourceID),
|
||||
OrganizationID: MustIDBase16(defaultSourceOrganizationID),
|
||||
Default: true,
|
||||
},
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
{
|
||||
Name: "name2",
|
||||
ID: MustIDFromString(sourceTwoID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceTwoID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -313,21 +313,21 @@ func DeleteSource(
|
|||
Sources: []*platform.Source{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(sourceOneID),
|
||||
OrganizationID: MustIDFromString(sourceOrgOneID),
|
||||
ID: MustIDBase16(sourceOneID),
|
||||
OrganizationID: MustIDBase16(sourceOrgOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(sourceOneID),
|
||||
id: MustIDBase16(sourceOneID),
|
||||
},
|
||||
wants: wants{
|
||||
sources: []*platform.Source{
|
||||
{
|
||||
Name: "autogen",
|
||||
Type: "self",
|
||||
ID: MustIDFromString(defaultSourceID),
|
||||
OrganizationID: MustIDFromString(defaultSourceOrganizationID),
|
||||
ID: MustIDBase16(defaultSourceID),
|
||||
OrganizationID: MustIDBase16(defaultSourceOrganizationID),
|
||||
Default: true,
|
||||
},
|
||||
},
|
||||
|
|
@ -340,7 +340,7 @@ func DeleteSource(
|
|||
Sources: []*platform.Source{},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(defaultSourceID),
|
||||
id: MustIDBase16(defaultSourceID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("cannot delete autogen source"),
|
||||
|
|
@ -348,8 +348,8 @@ func DeleteSource(
|
|||
{
|
||||
Name: "autogen",
|
||||
Type: "self",
|
||||
ID: MustIDFromString(defaultSourceID),
|
||||
OrganizationID: MustIDFromString(defaultSourceOrganizationID),
|
||||
ID: MustIDBase16(defaultSourceID),
|
||||
OrganizationID: MustIDBase16(defaultSourceOrganizationID),
|
||||
Default: true,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ func CreateUserResourceMapping(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -95,8 +95,8 @@ func CreateUserResourceMapping(
|
|||
},
|
||||
args: args{
|
||||
mapping: &platform.UserResourceMapping{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -104,14 +104,14 @@ func CreateUserResourceMapping(
|
|||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -123,24 +123,24 @@ func CreateUserResourceMapping(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
mapping: &platform.UserResourceMapping{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
},
|
||||
},
|
||||
|
|
@ -201,15 +201,15 @@ func DeleteUserResourceMapping(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
resourceID: MustIDFromString(bucketOneID),
|
||||
userID: MustIDFromString(userOneID),
|
||||
resourceID: MustIDBase16(bucketOneID),
|
||||
userID: MustIDBase16(userOneID),
|
||||
},
|
||||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{},
|
||||
|
|
@ -221,8 +221,8 @@ func DeleteUserResourceMapping(
|
|||
UserResourceMappings: []*platform.UserResourceMapping{},
|
||||
},
|
||||
args: args{
|
||||
resourceID: MustIDFromString(bucketOneID),
|
||||
userID: MustIDFromString(userOneID),
|
||||
resourceID: MustIDBase16(bucketOneID),
|
||||
userID: MustIDBase16(userOneID),
|
||||
},
|
||||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{},
|
||||
|
|
@ -281,14 +281,14 @@ func FindUserResourceMappings(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -300,14 +300,14 @@ func FindUserResourceMappings(
|
|||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -319,14 +319,14 @@ func FindUserResourceMappings(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -334,14 +334,14 @@ func FindUserResourceMappings(
|
|||
},
|
||||
args: args{
|
||||
filter: platform.UserResourceMappingFilter{
|
||||
UserID: MustIDFromString(userOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -353,14 +353,14 @@ func FindUserResourceMappings(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -368,14 +368,14 @@ func FindUserResourceMappings(
|
|||
},
|
||||
args: args{
|
||||
filter: platform.UserResourceMappingFilter{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
},
|
||||
},
|
||||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -387,14 +387,14 @@ func FindUserResourceMappings(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Owner,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -408,8 +408,8 @@ func FindUserResourceMappings(
|
|||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Owner,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -421,14 +421,14 @@ func FindUserResourceMappings(
|
|||
fields: UserResourceFields{
|
||||
UserResourceMappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketOneID),
|
||||
UserID: MustIDFromString(userOneID),
|
||||
ResourceID: MustIDBase16(bucketOneID),
|
||||
UserID: MustIDBase16(userOneID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.DashboardResourceType,
|
||||
},
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
@ -442,8 +442,8 @@ func FindUserResourceMappings(
|
|||
wants: wants{
|
||||
mappings: []*platform.UserResourceMapping{
|
||||
{
|
||||
ResourceID: MustIDFromString(bucketTwoID),
|
||||
UserID: MustIDFromString(userTwoID),
|
||||
ResourceID: MustIDBase16(bucketTwoID),
|
||||
UserID: MustIDBase16(userTwoID),
|
||||
UserType: platform.Member,
|
||||
ResourceType: platform.BucketResourceType,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ func CreateUser(
|
|||
users: []*platform.User{
|
||||
{
|
||||
Name: "name1",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -123,7 +123,7 @@ func CreateUser(
|
|||
IDGenerator: mock.NewIDGenerator(userTwoID, t),
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
},
|
||||
|
|
@ -136,11 +136,11 @@ func CreateUser(
|
|||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "user2",
|
||||
},
|
||||
},
|
||||
|
|
@ -151,12 +151,12 @@ func CreateUser(
|
|||
fields: UserFields{
|
||||
IDGenerator: &mock.IDGenerator{
|
||||
IDFn: func() platform.ID {
|
||||
return MustIDFromString(userOneID)
|
||||
return MustIDBase16(userOneID)
|
||||
},
|
||||
},
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
},
|
||||
|
|
@ -169,7 +169,7 @@ func CreateUser(
|
|||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
},
|
||||
|
|
@ -234,21 +234,21 @@ func FindUserByID(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "user2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(userTwoID),
|
||||
id: MustIDBase16(userTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
user: &platform.User{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "user2",
|
||||
},
|
||||
},
|
||||
|
|
@ -304,11 +304,11 @@ func FindUsers(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -317,11 +317,11 @@ func FindUsers(
|
|||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -332,22 +332,22 @@ func FindUsers(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -358,11 +358,11 @@ func FindUsers(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -373,7 +373,7 @@ func FindUsers(
|
|||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -438,22 +438,22 @@ func DeleteUser(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
wants: wants{
|
||||
users: []*platform.User{
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -464,27 +464,27 @@ func DeleteUser(
|
|||
Users: []*platform.User{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
ID: MustIDFromString(userThreeID),
|
||||
ID: MustIDBase16(userThreeID),
|
||||
},
|
||||
wants: wants{
|
||||
err: fmt.Errorf("user not found"),
|
||||
users: []*platform.User{
|
||||
{
|
||||
Name: "orgA",
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
},
|
||||
{
|
||||
Name: "orgB",
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -544,11 +544,11 @@ func FindUser(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "xyz",
|
||||
},
|
||||
},
|
||||
|
|
@ -558,7 +558,7 @@ func FindUser(
|
|||
},
|
||||
wants: wants{
|
||||
user: &platform.User{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "abc",
|
||||
},
|
||||
},
|
||||
|
|
@ -618,22 +618,22 @@ func UpdateUser(
|
|||
fields: UserFields{
|
||||
Users: []*platform.User{
|
||||
{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "user1",
|
||||
},
|
||||
{
|
||||
ID: MustIDFromString(userTwoID),
|
||||
ID: MustIDBase16(userTwoID),
|
||||
Name: "user2",
|
||||
},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
id: MustIDFromString(userOneID),
|
||||
id: MustIDBase16(userOneID),
|
||||
name: "changed",
|
||||
},
|
||||
wants: wants{
|
||||
user: &platform.User{
|
||||
ID: MustIDFromString(userOneID),
|
||||
ID: MustIDBase16(userOneID),
|
||||
Name: "changed",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"github.com/influxdata/platform"
|
||||
)
|
||||
|
||||
// MustIDFromString is an helper to ensure a correct ID is built during testing.
|
||||
func MustIDFromString(s string) platform.ID {
|
||||
// MustIDBase16 is an helper to ensure a correct ID is built during testing.
|
||||
func MustIDBase16(s string) platform.ID {
|
||||
id, err := platform.IDFromString(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "mapping requires a resourceid",
|
||||
fields: fields{
|
||||
UserID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
UserID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
UserType: platform.Owner,
|
||||
ResourceType: platform.DashboardResourceType,
|
||||
},
|
||||
|
|
@ -31,7 +31,7 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "mapping requires a userid",
|
||||
fields: fields{
|
||||
ResourceID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
ResourceID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserType: platform.Owner,
|
||||
ResourceType: platform.DashboardResourceType,
|
||||
},
|
||||
|
|
@ -40,8 +40,8 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "mapping requires a usertype",
|
||||
fields: fields{
|
||||
ResourceID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
ResourceID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
ResourceType: platform.DashboardResourceType,
|
||||
},
|
||||
wantErr: true,
|
||||
|
|
@ -49,8 +49,8 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "mapping requires a resourcetype",
|
||||
fields: fields{
|
||||
ResourceID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
ResourceID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
UserType: platform.Owner,
|
||||
},
|
||||
wantErr: true,
|
||||
|
|
@ -58,8 +58,8 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "the usertype provided must be valid",
|
||||
fields: fields{
|
||||
ResourceID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
ResourceID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
UserType: "foo",
|
||||
ResourceType: platform.DashboardResourceType,
|
||||
},
|
||||
|
|
@ -68,8 +68,8 @@ func TestOwnerMappingValidate(t *testing.T) {
|
|||
{
|
||||
name: "the resourcetype provided must be valid",
|
||||
fields: fields{
|
||||
ResourceID: platformtesting.MustIDFromString("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDFromString("debac1e0deadbeef"),
|
||||
ResourceID: platformtesting.MustIDBase16("020f755c3c082000"),
|
||||
UserID: platformtesting.MustIDBase16("debac1e0deadbeef"),
|
||||
UserType: platform.Owner,
|
||||
ResourceType: "foo",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func TestView_MarshalJSON(t *testing.T) {
|
|||
args: args{
|
||||
view: platform.View{
|
||||
ViewContents: platform.ViewContents{
|
||||
ID: platformtesting.MustIDFromString("f01dab1ef005ba11"),
|
||||
ID: platformtesting.MustIDBase16("f01dab1ef005ba11"),
|
||||
Name: "hello",
|
||||
},
|
||||
Properties: platform.LineViewProperties{
|
||||
|
|
|
|||
Loading…
Reference in New Issue