// inventoryCreate focus on issuing multiple requests some with repeated data
// and confirmation that the number or items created is as expected.
inventoryCreate focus on issuing multiple requests some with repeated data
and confirmation that the number or items created is as expected.
// inventoryCreate focus on issuing multiple requests some with repeated data // and confirmation that the number or items created is as expected .
func inventoryCreate(testName string) {
	_, err := clearInventory()
	if err != nil {
		fail(testName, err)
	}
	var ncis = []NodeConsoleInfo{}
	ncis = append(ncis, nci("x3000c0s1b0n0", "x3000c0s1b0", "x3000c0s1b0", "River", 100001, "Compute", ""))
	ncis = append(ncis, nci("x3000c0s2b0n0", "x3000c0s2b0", "x3000c0s2b0", "River", 100002, "Compute", ""))
	aop := InventoryApiOp{}
	recordCount, statusCode, responseBodyMessage, err := aop.Put(ncis)
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(2, int(recordCount), "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualStr("created=2", responseBodyMessage, "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(201, statusCode, "")
	if err != nil {
		fail(testName, err)
	}
	ncis = append(ncis, nci("x3000c0s3b0n0", "x3000c0s3b0", "x3000c0s3b0", "Mountain", 100003, "Compute", ""))
	ncis = append(ncis, nci("x3000c0s4b0n0", "x3000c0s4b0", "x3000c0s4b0", "Mountain", 100004, "Compute", ""))
	ncis = append(ncis, nci("x3000c0s5b0n0", "x3000c0s5b0", "x3000c0s5b0", "Mountain", 100005, "Compute", ""))
	aop = InventoryApiOp{}
	recordCount, statusCode, responseBodyMessage, err = aop.Put(ncis)
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(2+3, int(recordCount), "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualStr("created=3", responseBodyMessage, "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(201, statusCode, "")
	if err != nil {
		fail(testName, err)
	}
	aop = InventoryApiOp{}
	recordCount, statusCode, responseBodyMessage, err = aop.Put(ncis)
	err = assertEqualInt(2+3, int(recordCount), "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualStr("", responseBodyMessage, "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(200, statusCode, "")
	if err != nil {
		fail(testName, err)
	}
	pass(testName)
}
func inventoryCreate ( testName string ) { _ , err := clearInventory ( ) if err != nil { fail ( testName , err ) } var ncis = [ ] NodeConsoleInfo { } ncis = append ( ncis , nci ( " " , " " , " " , " " , 100001 , " " , " " ) ) ncis = append ( ncis , nci ( " " , " " , " " , " " , 100002 , " " , " " ) ) aop := InventoryApiOp { } recordCount , statusCode , responseBodyMessage , err := aop . Put ( ncis ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( 2 , int ( recordCount ) , " " ) if err != nil { fail ( testName , err ) } err = assertEqualStr ( " " , responseBodyMessage , " " ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( 201 , statusCode , " " ) if err != nil { fail ( testName , err ) } ncis = append ( ncis , nci ( " " , " " , " " , " " , 100003 , " " , " " ) ) ncis = append ( ncis , nci ( " " , " " , " " , " " , 100004 , " " , " " ) ) ncis = append ( ncis , nci ( " " , " " , " " , " " , 100005 , " " , " " ) ) aop = InventoryApiOp { } recordCount , statusCode , responseBodyMessage , err = aop . Put ( ncis ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( 2 + 3 , int ( recordCount ) , " " ) if err != nil { fail ( testName , err ) } err = assertEqualStr ( " " , responseBodyMessage , " " ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( 201 , statusCode , " " ) if err != nil { fail ( testName , err ) } aop = InventoryApiOp { } recordCount , statusCode , responseBodyMessage , err = aop . Put ( ncis ) err = assertEqualInt ( 2 + 3 , int ( recordCount ) , " " ) if err != nil { fail ( testName , err ) } err = assertEqualStr ( " " , responseBodyMessage , " " ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( 200 , statusCode , " " ) if err != nil { fail ( testName , err ) } pass ( testName ) }
inventoryCreate focus on issuing multiple requests some with repeated data
and confirmation that the number or items created is as expected.
inventoryCreate focus on issuing multiple requests some with repeated data and confirmation that the number or items created is as expected .
// Wipe any previous records // Expect 2 new records created // Total record count // Number created by this request // 201 status is expected. // Expect 3 new records created // Total record count // Number created by this request // 201 status is expected. // Repeat the previous request and expect no new records created // Number created by this request // 200 status is expected.