Skip to content

Commit

Permalink
Merge pull request #511 from detiber/lint
Browse files Browse the repository at this point in the history
Fix ineffective assignment in db/mock/template.go
  • Loading branch information
jacobweinstock authored Jul 2, 2021
2 parents 7f829f5 + fbe7262 commit ab6a1cc
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions db/mock/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Template struct {
}

// CreateTemplate creates a new workflow template
func (d DB) CreateTemplate(ctx context.Context, name string, data string, id uuid.UUID) error {
func (d *DB) CreateTemplate(ctx context.Context, name string, data string, id uuid.UUID) error {
if d.TemplateDB == nil {
d.TemplateDB = make(map[string]interface{})
}
Expand Down Expand Up @@ -66,6 +66,6 @@ func (d DB) UpdateTemplate(ctx context.Context, name string, data string, id uui
}

// ClearTemplateDB clear all the templates
func (d DB) ClearTemplateDB() {
func (d *DB) ClearTemplateDB() {
d.TemplateDB = make(map[string]interface{})
}
24 changes: 12 additions & 12 deletions grpc-server/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tasks:
func TestCreateTemplate(t *testing.T) {
type (
args struct {
db mock.DB
db *mock.DB
name string
template string
}
Expand All @@ -68,7 +68,7 @@ func TestCreateTemplate(t *testing.T) {
}{
"SuccessfulTemplateCreation": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: make(map[string]interface{}),
},
name: "template_1",
Expand All @@ -81,7 +81,7 @@ func TestCreateTemplate(t *testing.T) {

"SuccessfulMultipleTemplateCreation": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
"template_1": mock.Template{
Data: template1,
Expand All @@ -99,7 +99,7 @@ func TestCreateTemplate(t *testing.T) {

"FailedMultipleTemplateCreationWithSameName": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
"template_1": mock.Template{
Data: template1,
Expand All @@ -117,7 +117,7 @@ func TestCreateTemplate(t *testing.T) {

"SuccessfulTemplateCreationAfterDeletingWithSameName": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
"template_1": mock.Template{
Data: template1,
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestCreateTemplate(t *testing.T) {
func TestGetTemplate(t *testing.T) {
type (
args struct {
db mock.DB
db *mock.DB
getRequest *pb.GetRequest
}
)
Expand All @@ -169,7 +169,7 @@ func TestGetTemplate(t *testing.T) {
}{
"SuccessfulTemplateGet_Name": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestGetTemplate(t *testing.T) {

"FailedTemplateGet_Name": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down Expand Up @@ -231,7 +231,7 @@ func TestGetTemplate(t *testing.T) {

"SuccessfulTemplateGet_ID": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestGetTemplate(t *testing.T) {

"FailedTemplateGet_ID": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down Expand Up @@ -293,7 +293,7 @@ func TestGetTemplate(t *testing.T) {

"FailedTemplateGet_EmptyRequest": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down Expand Up @@ -324,7 +324,7 @@ func TestGetTemplate(t *testing.T) {

"FailedTemplateGet_NilRequest": {
args: args{
db: mock.DB{
db: &mock.DB{
TemplateDB: map[string]interface{}{
templateName1: template1,
},
Expand Down
Loading

0 comments on commit ab6a1cc

Please sign in to comment.