gofmt
parent
3d18984c70
commit
8c045ad08a
|
@ -247,13 +247,11 @@ func (h *VariableHandler) handlePostVariable(w http.ResponseWriter, r *http.Requ
|
||||||
va := new(platform.Variable)
|
va := new(platform.Variable)
|
||||||
va = req.variable
|
va = req.variable
|
||||||
|
|
||||||
fmt.Println("1-->", va)
|
|
||||||
err = h.VariableService.CreateVariable(ctx, va)
|
err = h.VariableService.CreateVariable(ctx, va)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
EncodeError(ctx, err, w)
|
EncodeError(ctx, err, w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println("2-->",va)
|
|
||||||
if err := encodeResponse(ctx, w, http.StatusCreated, newVariableResponse(req.variable, []*platform.Label{})); err != nil {
|
if err := encodeResponse(ctx, w, http.StatusCreated, newVariableResponse(req.variable, []*platform.Label{})); err != nil {
|
||||||
logEncodingError(h.Logger, r, err)
|
logEncodingError(h.Logger, r, err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -31,6 +31,7 @@ var bucketCmpOptions = cmp.Options{
|
||||||
return out
|
return out
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
// BucketFields will include the IDGenerator, and buckets
|
// BucketFields will include the IDGenerator, and buckets
|
||||||
type BucketFields struct {
|
type BucketFields struct {
|
||||||
IDGenerator platform.IDGenerator
|
IDGenerator platform.IDGenerator
|
||||||
|
|
|
@ -56,22 +56,22 @@ func VariableService(
|
||||||
name: "CreateVariable",
|
name: "CreateVariable",
|
||||||
fn: CreateVariable,
|
fn: CreateVariable,
|
||||||
},
|
},
|
||||||
//{
|
{
|
||||||
// name: "FindVariableByID",
|
name: "FindVariableByID",
|
||||||
// fn: FindVariableByID,
|
fn: FindVariableByID,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// name: "FindVariables",
|
name: "FindVariables",
|
||||||
// fn: FindVariables,
|
fn: FindVariables,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// name: "UpdateVariable",
|
name: "UpdateVariable",
|
||||||
// fn: UpdateVariable,
|
fn: UpdateVariable,
|
||||||
//},
|
},
|
||||||
//{
|
{
|
||||||
// name: "DeleteVariable",
|
name: "DeleteVariable",
|
||||||
// fn: DeleteVariable,
|
fn: DeleteVariable,
|
||||||
//},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
@ -148,74 +148,74 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
//{
|
{
|
||||||
// name: "creating a variable assigns the variable an id and adds it to the store",
|
name: "creating a variable assigns the variable an id and adds it to the store",
|
||||||
// fields: VariableFields{
|
fields: VariableFields{
|
||||||
// IDGenerator: &mock.IDGenerator{
|
IDGenerator: &mock.IDGenerator{
|
||||||
// IDFn: func() platform.ID {
|
IDFn: func() platform.ID {
|
||||||
// return MustIDBase16(idA)
|
return MustIDBase16(idA)
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// TimeGenerator: fakeGenerator,
|
TimeGenerator: fakeGenerator,
|
||||||
// Variables: []*platform.Variable{
|
Variables: []*platform.Variable{
|
||||||
// {
|
{
|
||||||
// ID: MustIDBase16(idB),
|
ID: MustIDBase16(idB),
|
||||||
// OrganizationID: platform.ID(3),
|
OrganizationID: platform.ID(3),
|
||||||
// Name: "existing-variable",
|
Name: "existing-variable",
|
||||||
// Selected: []string{"b"},
|
Selected: []string{"b"},
|
||||||
// Arguments: &platform.VariableArguments{
|
Arguments: &platform.VariableArguments{
|
||||||
// Type: "constant",
|
Type: "constant",
|
||||||
// Values: platform.VariableConstantValues{"b"},
|
Values: platform.VariableConstantValues{"b"},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// args: args{
|
args: args{
|
||||||
// variable: &platform.Variable{
|
variable: &platform.Variable{
|
||||||
// ID: MustIDBase16(idA),
|
ID: MustIDBase16(idA),
|
||||||
// OrganizationID: platform.ID(3),
|
OrganizationID: platform.ID(3),
|
||||||
// Name: "my-variable",
|
Name: "my-variable",
|
||||||
// Selected: []string{"a"},
|
Selected: []string{"a"},
|
||||||
// Arguments: &platform.VariableArguments{
|
Arguments: &platform.VariableArguments{
|
||||||
// Type: "constant",
|
Type: "constant",
|
||||||
// Values: platform.VariableConstantValues{"a"},
|
Values: platform.VariableConstantValues{"a"},
|
||||||
// },
|
},
|
||||||
// CRUDLog: platform.CRUDLog{
|
CRUDLog: platform.CRUDLog{
|
||||||
// CreatedAt: fakeDate,
|
CreatedAt: fakeDate,
|
||||||
// UpdatedAt: fakeDate,
|
UpdatedAt: fakeDate,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// wants: wants{
|
wants: wants{
|
||||||
// err: nil,
|
err: nil,
|
||||||
// variables: []*platform.Variable{
|
variables: []*platform.Variable{
|
||||||
// {
|
{
|
||||||
// ID: MustIDBase16(idB),
|
ID: MustIDBase16(idB),
|
||||||
// OrganizationID: platform.ID(3),
|
OrganizationID: platform.ID(3),
|
||||||
// Name: "existing-variable",
|
Name: "existing-variable",
|
||||||
// Selected: []string{"b"},
|
Selected: []string{"b"},
|
||||||
// Arguments: &platform.VariableArguments{
|
Arguments: &platform.VariableArguments{
|
||||||
// Type: "constant",
|
Type: "constant",
|
||||||
// Values: platform.VariableConstantValues{"b"},
|
Values: platform.VariableConstantValues{"b"},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// ID: MustIDBase16(idA),
|
ID: MustIDBase16(idA),
|
||||||
// OrganizationID: platform.ID(3),
|
OrganizationID: platform.ID(3),
|
||||||
// Name: "my-variable",
|
Name: "my-variable",
|
||||||
// Selected: []string{"a"},
|
Selected: []string{"a"},
|
||||||
// Arguments: &platform.VariableArguments{
|
Arguments: &platform.VariableArguments{
|
||||||
// Type: "constant",
|
Type: "constant",
|
||||||
// Values: platform.VariableConstantValues{"a"},
|
Values: platform.VariableConstantValues{"a"},
|
||||||
// },
|
},
|
||||||
// CRUDLog: platform.CRUDLog{
|
CRUDLog: platform.CRUDLog{
|
||||||
// CreatedAt: fakeDate,
|
CreatedAt: fakeDate,
|
||||||
// UpdatedAt: fakeDate,
|
UpdatedAt: fakeDate,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
//},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
Loading…
Reference in New Issue