1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
package testing
import (
"testing"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/startstop"
th "github.com/gophercloud/gophercloud/testhelper"
"github.com/gophercloud/gophercloud/testhelper/client"
)
const serverID = "{serverId}"
func TestStart(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockStartServerResponse(t, serverID)
err := startstop.Start(client.ServiceClient(), serverID).ExtractErr()
th.AssertNoErr(t, err)
}
func TestStop(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
mockStopServerResponse(t, serverID)
err := startstop.Stop(client.ServiceClient(), serverID).ExtractErr()
th.AssertNoErr(t, err)
}
|