// 2020 Rackspace, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"): you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package finalize import ( "testing" "github.rackspace.com/gorax/clients/dcxAutohost" "github.rackspace.com/gorax/clients/migrationAPI" ) func TestPrint(t *testing.T) { testData := []resultType{ { id: 123456, model: "Cisco ASA 5525", finalize: dcxAutohost.JobStatus{ Name: "KIR::Finalize::ServerFinalizeWorker", Pct: 100, UUID: "e89ca510e19ab7c30adf4ee6", Message: []byte("Successfully completed Kick in the Rack port turn-up for 1056610 in 139 seconds"), Status: "completed", Errors: nil, }, postFinalize: migrationAPI.PostFinalizeResp{ Data: migrationAPI.PostFinalizeData{ Changes: []string{}, Errors: []string{"Error occurred while migrating device 1051215: Failed. Response code = 504. Response message = Gateway Time-out."}, }, Error: nil, }, }, { id: 550550, model: "Cisco ASA 5525", finalize: dcxAutohost.JobStatus{ Name: "KIR::Finalize::ServerFinalizeWorker", Pct: 100, UUID: "e89ca510e19ab7c30adf4ee6", Message: []byte("Successfully completed Kick in the Rack port turn-up for 1056610 in 139 seconds"), Status: "completed", Errors: nil, }, postFinalize: migrationAPI.PostFinalizeResp{ Data: migrationAPI.PostFinalizeData{ Changes: []string{"ports changes"}, Errors: nil, }, Error: nil, }, }, } pPrint(testData[0]) if err := csv(testData, "Test_FinalizeResults", "Test_Sheet1"); err != nil { t.Fatal(err) } }