ostesting "github.com/globocom/go-openstack/testing"
	"io/ioutil"
	. "launchpad.net/gocheck"
	"testing"
)

var _ = Suite(&S{})

type S struct {
	response       string
	brokenResponse string
}

func Test(t *testing.T) { TestingT(t) }

var testServer = ostesting.NewTestHTTPServer("http://localhost:4444", 10e9)

func (s *S) SetUpSuite(c *C) {
	testServer.Start()
	body, err := ioutil.ReadFile("testdata/response.json")
	c.Assert(err, IsNil)
	s.response = string(body)
	brokenBody, err := ioutil.ReadFile("testdata/broken_response.json")
	c.Assert(err, IsNil)
	s.brokenResponse = string(brokenBody)
}

func (s *S) TearDownTest(c *C) {
	testServer.FlushRequests()
}
Example #2
0
import (
	"github.com/globocom/go-openstack/keystone"
	ostesting "github.com/globocom/go-openstack/testing"
	. "launchpad.net/gocheck"
	"testing"
)

type S struct{}

var _ = Suite(&S{})

func Test(t *testing.T) {
	TestingT(t)
}

var testServer = ostesting.NewTestHTTPServer("http://localhost:5555", 1e9)

func (s *S) SetUpSuite(c *C) {
	testServer.Start()
}

func (s *S) TearDownTest(c *C) {
	testServer.FlushRequests()
}

func (s *S) TestDisassociateNetwork(c *C) {
	kclient := keystone.Client{
		Token: "123token",
		Catalogs: []keystone.ServiceCatalog{
			{
				Name: "Compute Service",