github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/controllers/databaseop/databaseop_test.go (about) 1 package databaseop 2 3 import ( 4 "reflect" 5 "testing" 6 7 "github.com/gin-gonic/gin" 8 ) 9 10 func TestDBController_GetDatabyQuery(t *testing.T) { 11 type args struct { 12 ctx *gin.Context 13 } 14 tests := []struct { 15 name string 16 db *DBController 17 args args 18 }{ 19 // TODO: Add test cases. 20 } 21 for _, tt := range tests { 22 t.Run(tt.name, func(t *testing.T) { 23 tt.db.GetDatabyQuery(tt.args.ctx) 24 }) 25 } 26 } 27 28 func TestDBController_GetDataFromTables(t *testing.T) { 29 type args struct { 30 ctx *gin.Context 31 } 32 tests := []struct { 33 name string 34 db *DBController 35 args args 36 }{ 37 // TODO: Add test cases. 38 } 39 for _, tt := range tests { 40 t.Run(tt.name, func(t *testing.T) { 41 tt.db.GetDataFromTables(tt.args.ctx) 42 }) 43 } 44 } 45 46 func TestDBController_getDataStructForQuery(t *testing.T) { 47 type args struct { 48 data map[string]interface{} 49 user string 50 clientid string 51 } 52 tests := []struct { 53 name string 54 db *DBController 55 args args 56 want string 57 want1 string 58 wantErr bool 59 }{ 60 // TODO: Add test cases. 61 } 62 for _, tt := range tests { 63 t.Run(tt.name, func(t *testing.T) { 64 got, got1, err := tt.db.getDataStructForQuery(tt.args.data, tt.args.user, tt.args.clientid) 65 if (err != nil) != tt.wantErr { 66 t.Errorf("DBController.getDataStructForQuery() error = %v, wantErr %v", err, tt.wantErr) 67 return 68 } 69 if got != tt.want { 70 t.Errorf("DBController.getDataStructForQuery() got = %v, want %v", got, tt.want) 71 } 72 if got1 != tt.want1 { 73 t.Errorf("DBController.getDataStructForQuery() got1 = %v, want %v", got1, tt.want1) 74 } 75 }) 76 } 77 } 78 79 func TestDBController_getmysqlsubtabls(t *testing.T) { 80 type args struct { 81 tablename string 82 data map[string]interface{} 83 markasJson bool 84 user string 85 clientid string 86 } 87 tests := []struct { 88 name string 89 db *DBController 90 args args 91 want string 92 want1 string 93 wantErr bool 94 }{ 95 // TODO: Add test cases. 96 } 97 for _, tt := range tests { 98 t.Run(tt.name, func(t *testing.T) { 99 got, got1, err := tt.db.getmysqlsubtabls(tt.args.tablename, tt.args.data, tt.args.markasJson, tt.args.user, tt.args.clientid) 100 if (err != nil) != tt.wantErr { 101 t.Errorf("DBController.getmysqlsubtabls() error = %v, wantErr %v", err, tt.wantErr) 102 return 103 } 104 if got != tt.want { 105 t.Errorf("DBController.getmysqlsubtabls() got = %v, want %v", got, tt.want) 106 } 107 if got1 != tt.want1 { 108 t.Errorf("DBController.getmysqlsubtabls() got1 = %v, want %v", got1, tt.want1) 109 } 110 }) 111 } 112 } 113 114 func TestDBController_getsubtabls(t *testing.T) { 115 type args struct { 116 tablename string 117 data map[string]interface{} 118 markasJson bool 119 user string 120 clientid string 121 } 122 tests := []struct { 123 name string 124 db *DBController 125 args args 126 want string 127 wantErr bool 128 }{ 129 // TODO: Add test cases. 130 } 131 for _, tt := range tests { 132 t.Run(tt.name, func(t *testing.T) { 133 got, err := tt.db.getsubtabls(tt.args.tablename, tt.args.data, tt.args.markasJson, tt.args.user, tt.args.clientid) 134 if (err != nil) != tt.wantErr { 135 t.Errorf("DBController.getsubtabls() error = %v, wantErr %v", err, tt.wantErr) 136 return 137 } 138 if got != tt.want { 139 t.Errorf("DBController.getsubtabls() = %v, want %v", got, tt.want) 140 } 141 }) 142 } 143 } 144 145 func TestDBController_InsertDataToTable(t *testing.T) { 146 type args struct { 147 ctx *gin.Context 148 } 149 tests := []struct { 150 name string 151 db *DBController 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 if err := tt.db.InsertDataToTable(tt.args.ctx); (err != nil) != tt.wantErr { 160 t.Errorf("DBController.InsertDataToTable() error = %v, wantErr %v", err, tt.wantErr) 161 } 162 }) 163 } 164 } 165 166 func TestDBController_UpdateDataToTable(t *testing.T) { 167 type args struct { 168 ctx *gin.Context 169 } 170 tests := []struct { 171 name string 172 db *DBController 173 args args 174 wantErr bool 175 }{ 176 // TODO: Add test cases. 177 } 178 for _, tt := range tests { 179 t.Run(tt.name, func(t *testing.T) { 180 if err := tt.db.UpdateDataToTable(tt.args.ctx); (err != nil) != tt.wantErr { 181 t.Errorf("DBController.UpdateDataToTable() error = %v, wantErr %v", err, tt.wantErr) 182 } 183 }) 184 } 185 } 186 187 func TestDBController_DeleteDataFromTable(t *testing.T) { 188 type args struct { 189 ctx *gin.Context 190 } 191 tests := []struct { 192 name string 193 db *DBController 194 args args 195 wantErr bool 196 }{ 197 // TODO: Add test cases. 198 } 199 for _, tt := range tests { 200 t.Run(tt.name, func(t *testing.T) { 201 if err := tt.db.DeleteDataFromTable(tt.args.ctx); (err != nil) != tt.wantErr { 202 t.Errorf("DBController.DeleteDataFromTable() error = %v, wantErr %v", err, tt.wantErr) 203 } 204 }) 205 } 206 } 207 208 func TestDBController_GetDataFromRequest(t *testing.T) { 209 type args struct { 210 ctx *gin.Context 211 } 212 tests := []struct { 213 name string 214 db *DBController 215 args args 216 want DBData 217 wantErr bool 218 }{ 219 // TODO: Add test cases. 220 } 221 for _, tt := range tests { 222 t.Run(tt.name, func(t *testing.T) { 223 got, err := tt.db.GetDataFromRequest(tt.args.ctx) 224 if (err != nil) != tt.wantErr { 225 t.Errorf("DBController.GetDataFromRequest() error = %v, wantErr %v", err, tt.wantErr) 226 return 227 } 228 if !reflect.DeepEqual(got, tt.want) { 229 t.Errorf("DBController.GetDataFromRequest() = %v, want %v", got, tt.want) 230 } 231 }) 232 } 233 }