@@ -194,7 +194,7 @@ func TestModifyAssetStatus(t *testing.T) {
194
194
195
195
utils := & UtilsStruct {}
196
196
197
- got , err := utils .ModifyAssetStatus (client , config , types.ModifyAssetInput {
197
+ got , err := utils .ModifyCollectionStatus (client , config , types.ModifyCollectionInput {
198
198
Status : tt .args .status ,
199
199
})
200
200
if got != tt .want {
@@ -220,19 +220,19 @@ func TestExecuteModifyAssetStatus(t *testing.T) {
220
220
var client * ethclient.Client
221
221
222
222
type args struct {
223
- config types.Configurations
224
- configErr error
225
- address string
226
- addressErr error
227
- assetId uint16
228
- assetIdErr error
229
- status string
230
- statusErr error
231
- parseStatus bool
232
- parseStatusErr error
233
- password string
234
- ModifyAssetStatusHash common.Hash
235
- ModifyAssetStatusErr error
223
+ config types.Configurations
224
+ configErr error
225
+ address string
226
+ addressErr error
227
+ collectionId uint16
228
+ collectionIdErr error
229
+ status string
230
+ statusErr error
231
+ parseStatus bool
232
+ parseStatusErr error
233
+ password string
234
+ ModifyCollectionStatusHash common.Hash
235
+ ModifyCollectionStatusErr error
236
236
}
237
237
tests := []struct {
238
238
name string
@@ -242,94 +242,94 @@ func TestExecuteModifyAssetStatus(t *testing.T) {
242
242
{
243
243
name : "Test 1: When ModifyAssetStatus executes successfully" ,
244
244
args : args {
245
- config : config ,
246
- address : "0x000000000000000000000000000000000000dea1" ,
247
- assetId : 1 ,
248
- status : "true" ,
249
- parseStatus : true ,
250
- password : "test" ,
251
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
245
+ config : config ,
246
+ address : "0x000000000000000000000000000000000000dea1" ,
247
+ collectionId : 1 ,
248
+ status : "true" ,
249
+ parseStatus : true ,
250
+ password : "test" ,
251
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
252
252
},
253
253
expectedFatal : false ,
254
254
},
255
255
{
256
256
name : "Test 2: When there is an error in getting address" ,
257
257
args : args {
258
- config : config ,
259
- address : "" ,
260
- addressErr : errors .New ("address error" ),
261
- assetId : 1 ,
262
- status : "true" ,
263
- parseStatus : true ,
264
- password : "test" ,
265
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
258
+ config : config ,
259
+ address : "" ,
260
+ addressErr : errors .New ("address error" ),
261
+ collectionId : 1 ,
262
+ status : "true" ,
263
+ parseStatus : true ,
264
+ password : "test" ,
265
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
266
266
},
267
267
expectedFatal : true ,
268
268
},
269
269
{
270
- name : "Test 3: When there is an error in getting assetId " ,
270
+ name : "Test 3: When there is an error in getting collectionId " ,
271
271
args : args {
272
- config : config ,
273
- address : "0x000000000000000000000000000000000000dea1" ,
274
- assetIdErr : errors .New ("assetId error" ),
275
- status : "true" ,
276
- parseStatus : true ,
277
- password : "test" ,
278
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
272
+ config : config ,
273
+ address : "0x000000000000000000000000000000000000dea1" ,
274
+ collectionIdErr : errors .New ("assetId error" ),
275
+ status : "true" ,
276
+ parseStatus : true ,
277
+ password : "test" ,
278
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
279
279
},
280
280
expectedFatal : true ,
281
281
},
282
282
{
283
283
name : "Test 4: When there is an error in getting status string" ,
284
284
args : args {
285
- config : config ,
286
- address : "0x000000000000000000000000000000000000dea1" ,
287
- assetId : 1 ,
288
- statusErr : errors .New ("status error" ),
289
- parseStatus : true ,
290
- password : "test" ,
291
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
285
+ config : config ,
286
+ address : "0x000000000000000000000000000000000000dea1" ,
287
+ collectionId : 1 ,
288
+ statusErr : errors .New ("status error" ),
289
+ parseStatus : true ,
290
+ password : "test" ,
291
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
292
292
},
293
293
expectedFatal : true ,
294
294
},
295
295
{
296
296
name : "Test 5: When there is an error in parsing status to bool" ,
297
297
args : args {
298
- config : config ,
299
- address : "0x000000000000000000000000000000000000dea1" ,
300
- assetId : 1 ,
301
- status : "true" ,
302
- parseStatusErr : errors .New ("parsing status error" ),
303
- password : "test" ,
304
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
298
+ config : config ,
299
+ address : "0x000000000000000000000000000000000000dea1" ,
300
+ collectionId : 1 ,
301
+ status : "true" ,
302
+ parseStatusErr : errors .New ("parsing status error" ),
303
+ password : "test" ,
304
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
305
305
},
306
306
expectedFatal : true ,
307
307
},
308
308
{
309
309
name : "Test 6: When there is an error from ModifyAssetStatus" ,
310
310
args : args {
311
- config : config ,
312
- address : "0x000000000000000000000000000000000000dea1" ,
313
- assetId : 1 ,
314
- status : "true" ,
315
- parseStatus : true ,
316
- password : "test" ,
317
- ModifyAssetStatusHash : core .NilHash ,
318
- ModifyAssetStatusErr : errors .New ("ModifyAssetStatus error" ),
311
+ config : config ,
312
+ address : "0x000000000000000000000000000000000000dea1" ,
313
+ collectionId : 1 ,
314
+ status : "true" ,
315
+ parseStatus : true ,
316
+ password : "test" ,
317
+ ModifyCollectionStatusHash : core .NilHash ,
318
+ ModifyCollectionStatusErr : errors .New ("ModifyAssetStatus error" ),
319
319
},
320
320
expectedFatal : true ,
321
321
},
322
322
{
323
323
name : "Test 7: When there ia n error in getting config" ,
324
324
args : args {
325
- config : config ,
326
- configErr : errors .New ("config error" ),
327
- address : "0x000000000000000000000000000000000000dea1" ,
328
- assetId : 1 ,
329
- status : "true" ,
330
- parseStatus : true ,
331
- password : "test" ,
332
- ModifyAssetStatusHash : common .BigToHash (big .NewInt (1 )),
325
+ config : config ,
326
+ configErr : errors .New ("config error" ),
327
+ address : "0x000000000000000000000000000000000000dea1" ,
328
+ collectionId : 1 ,
329
+ status : "true" ,
330
+ parseStatus : true ,
331
+ password : "test" ,
332
+ ModifyCollectionStatusHash : common .BigToHash (big .NewInt (1 )),
333
333
},
334
334
expectedFatal : true ,
335
335
},
@@ -355,18 +355,18 @@ func TestExecuteModifyAssetStatus(t *testing.T) {
355
355
utilsMock .On ("AssignLogFile" , mock .AnythingOfType ("*pflag.FlagSet" ))
356
356
cmdUtilsMock .On ("GetConfigData" ).Return (tt .args .config , tt .args .configErr )
357
357
flagsetUtilsMock .On ("GetStringAddress" , flagSet ).Return (tt .args .address , tt .args .addressErr )
358
- flagsetUtilsMock .On ("GetUint16AssetId " , flagSet ).Return (tt .args .assetId , tt .args .assetIdErr )
358
+ flagsetUtilsMock .On ("GetUint16CollectionId " , flagSet ).Return (tt .args .collectionId , tt .args .collectionIdErr )
359
359
flagsetUtilsMock .On ("GetStringStatus" , flagSet ).Return (tt .args .status , tt .args .statusErr )
360
360
utilsMock .On ("AssignPassword" , flagSet ).Return (tt .args .password )
361
361
stringMock .On ("ParseBool" , mock .AnythingOfType ("string" )).Return (tt .args .parseStatus , tt .args .parseStatusErr )
362
362
utilsMock .On ("ConnectToClient" , mock .AnythingOfType ("string" )).Return (client )
363
- cmdUtilsMock .On ("ModifyAssetStatus " , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .ModifyAssetStatusHash , tt .args .ModifyAssetStatusErr )
363
+ cmdUtilsMock .On ("ModifyCollectionStatus " , mock .Anything , mock .Anything , mock .Anything ).Return (tt .args .ModifyCollectionStatusHash , tt .args .ModifyCollectionStatusErr )
364
364
utilsMock .On ("WaitForBlockCompletion" , mock .AnythingOfType ("*ethclient.Client" ), mock .AnythingOfType ("string" )).Return (1 )
365
365
366
366
utils := & UtilsStruct {}
367
367
fatal = false
368
368
369
- utils .ExecuteModifyAssetStatus (flagSet )
369
+ utils .ExecuteModifyCollectionStatus (flagSet )
370
370
371
371
if fatal != tt .expectedFatal {
372
372
t .Error ("The ExecuteModifyAssetStatus function didn't execute as expected" )
0 commit comments