packer-cn/builder/oracle/bmcs/client/vnic_attachment_test.go
Andrew Pryde 9728f890cf Implemented and documented oracle-bmcs builder
Implements a new Packer builder (oracle-bmcs) which adds support for
building custom images for Oracle Bare Metal Cloud Services (BMCS)
https://cloud.oracle.com/en_US/bare-metal.

Additionally includes documentation for the oracle-bmcs builder.
2017-08-02 09:53:48 +01:00

38 lines
1.0 KiB
Go

// Copyright (c) 2017 Oracle America, Inc.
// The contents of this file are subject to the Mozilla Public License Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/
package bmcs
import (
"fmt"
"net/http"
"reflect"
"testing"
)
func TestListVNICAttachments(t *testing.T) {
setup()
defer teardown()
id := "ocid1.image.oc1.phx.a"
mux.HandleFunc("/vnicAttachments/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, `[{"id":"%s"}]`, id)
})
params := &ListVnicAttachmentsParams{InstanceID: id}
vnicAttachment, err := client.Compute.VNICAttachments.List(params)
if err != nil {
t.Errorf("Client.Compute.VNICAttachments.List() returned error: %v", err)
}
want := []VNICAttachment{{ID: id}}
if !reflect.DeepEqual(vnicAttachment, want) {
t.Errorf("Client.Compute.VNICAttachments.List() returned %+v, want %+v", vnicAttachment, want)
}
}