github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/api/controllers/action_test.go (about) 1 // This file is part of the Smart Home 2 // Program complex distribution https://github.com/e154/smart-home 3 // Copyright (C) 2023, Filippov Alex 4 // 5 // This library is free software: you can redistribute it and/or 6 // modify it under the terms of the GNU Lesser General Public 7 // License as published by the Free Software Foundation; either 8 // version 3 of the License, or (at your option) any later version. 9 // 10 // This library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // Library General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public 16 // License along with this library. If not, see 17 // <https://www.gnu.org/licenses/>. 18 19 package controllers 20 21 import ( 22 "reflect" 23 "testing" 24 25 "github.com/e154/smart-home/api/stub" 26 "github.com/labstack/echo/v4" 27 ) 28 29 func TestControllerAction_ActionServiceAddAction(t *testing.T) { 30 type fields struct { 31 ControllerCommon *ControllerCommon 32 } 33 type args struct { 34 ctx echo.Context 35 in1 stub.ActionServiceAddActionParams 36 } 37 tests := []struct { 38 name string 39 fields fields 40 args args 41 wantErr bool 42 }{ 43 // TODO: Add test cases. 44 } 45 for _, tt := range tests { 46 t.Run(tt.name, func(t *testing.T) { 47 c := ControllerAction{ 48 ControllerCommon: tt.fields.ControllerCommon, 49 } 50 if err := c.ActionServiceAddAction(tt.args.ctx, tt.args.in1); (err != nil) != tt.wantErr { 51 t.Errorf("ActionServiceAddAction() error = %v, wantErr %v", err, tt.wantErr) 52 } 53 }) 54 } 55 } 56 57 func TestControllerAction_ActionServiceDeleteAction(t *testing.T) { 58 type fields struct { 59 ControllerCommon *ControllerCommon 60 } 61 type args struct { 62 ctx echo.Context 63 id int64 64 } 65 tests := []struct { 66 name string 67 fields fields 68 args args 69 wantErr bool 70 }{ 71 // TODO: Add test cases. 72 } 73 for _, tt := range tests { 74 t.Run(tt.name, func(t *testing.T) { 75 c := ControllerAction{ 76 ControllerCommon: tt.fields.ControllerCommon, 77 } 78 if err := c.ActionServiceDeleteAction(tt.args.ctx, tt.args.id); (err != nil) != tt.wantErr { 79 t.Errorf("ActionServiceDeleteAction() error = %v, wantErr %v", err, tt.wantErr) 80 } 81 }) 82 } 83 } 84 85 func TestControllerAction_ActionServiceGetActionById(t *testing.T) { 86 type fields struct { 87 ControllerCommon *ControllerCommon 88 } 89 type args struct { 90 ctx echo.Context 91 id int64 92 } 93 tests := []struct { 94 name string 95 fields fields 96 args args 97 wantErr bool 98 }{ 99 // TODO: Add test cases. 100 } 101 for _, tt := range tests { 102 t.Run(tt.name, func(t *testing.T) { 103 c := ControllerAction{ 104 ControllerCommon: tt.fields.ControllerCommon, 105 } 106 if err := c.ActionServiceGetActionById(tt.args.ctx, tt.args.id); (err != nil) != tt.wantErr { 107 t.Errorf("ActionServiceGetActionById() error = %v, wantErr %v", err, tt.wantErr) 108 } 109 }) 110 } 111 } 112 113 func TestControllerAction_ActionServiceGetActionList(t *testing.T) { 114 type fields struct { 115 ControllerCommon *ControllerCommon 116 } 117 type args struct { 118 ctx echo.Context 119 params stub.ActionServiceGetActionListParams 120 } 121 tests := []struct { 122 name string 123 fields fields 124 args args 125 wantErr bool 126 }{ 127 // TODO: Add test cases. 128 } 129 for _, tt := range tests { 130 t.Run(tt.name, func(t *testing.T) { 131 c := ControllerAction{ 132 ControllerCommon: tt.fields.ControllerCommon, 133 } 134 if err := c.ActionServiceGetActionList(tt.args.ctx, tt.args.params); (err != nil) != tt.wantErr { 135 t.Errorf("ActionServiceGetActionList() error = %v, wantErr %v", err, tt.wantErr) 136 } 137 }) 138 } 139 } 140 141 func TestControllerAction_ActionServiceSearchAction(t *testing.T) { 142 type fields struct { 143 ControllerCommon *ControllerCommon 144 } 145 type args struct { 146 ctx echo.Context 147 params stub.ActionServiceSearchActionParams 148 } 149 tests := []struct { 150 name string 151 fields fields 152 args args 153 wantErr bool 154 }{ 155 // TODO: Add test cases. 156 } 157 for _, tt := range tests { 158 t.Run(tt.name, func(t *testing.T) { 159 c := ControllerAction{ 160 ControllerCommon: tt.fields.ControllerCommon, 161 } 162 if err := c.ActionServiceSearchAction(tt.args.ctx, tt.args.params); (err != nil) != tt.wantErr { 163 t.Errorf("ActionServiceSearchAction() error = %v, wantErr %v", err, tt.wantErr) 164 } 165 }) 166 } 167 } 168 169 func TestControllerAction_ActionServiceUpdateAction(t *testing.T) { 170 type fields struct { 171 ControllerCommon *ControllerCommon 172 } 173 type args struct { 174 ctx echo.Context 175 id int64 176 in2 stub.ActionServiceUpdateActionParams 177 } 178 tests := []struct { 179 name string 180 fields fields 181 args args 182 wantErr bool 183 }{ 184 // TODO: Add test cases. 185 } 186 for _, tt := range tests { 187 t.Run(tt.name, func(t *testing.T) { 188 c := ControllerAction{ 189 ControllerCommon: tt.fields.ControllerCommon, 190 } 191 if err := c.ActionServiceUpdateAction(tt.args.ctx, tt.args.id, tt.args.in2); (err != nil) != tt.wantErr { 192 t.Errorf("ActionServiceUpdateAction() error = %v, wantErr %v", err, tt.wantErr) 193 } 194 }) 195 } 196 } 197 198 func TestNewControllerAction(t *testing.T) { 199 type args struct { 200 common *ControllerCommon 201 } 202 tests := []struct { 203 name string 204 args args 205 want *ControllerAction 206 }{ 207 // TODO: Add test cases. 208 } 209 for _, tt := range tests { 210 t.Run(tt.name, func(t *testing.T) { 211 if got := NewControllerAction(tt.args.common); !reflect.DeepEqual(got, tt.want) { 212 t.Errorf("NewControllerAction() = %v, want %v", got, tt.want) 213 } 214 }) 215 } 216 }