You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
823 B

package vcontrol
import (
"os"
. "testing"
. "gopkg.in/check.v1"
"github.com/erikh/vcontrol/context"
"github.com/erikh/vcontrol/providers/vmware"
)
type vcontrolSuite struct{}
var _ = Suite(&vcontrolSuite{})
func TestVControl(t *T) {
TestingT(t)
}
func (vc *vcontrolSuite) TestInit(c *C) {
// FIXME this test will fail on any machine that doesn't have vmware
// installed; solution: make a mock provider
ctx, err := Init(os.Environ())
c.Assert(err, IsNil)
c.Assert(ctx.Providers[0].Name(), Equals, "vmware")
}
func (vc *vcontrolSuite) TestInitWithProviders(c *C) {
vmw := &vmware.Provider{}
ctx, err := InitWithProviders([]context.Provider{vmw}, os.Environ())
c.Assert(ctx, NotNil)
c.Assert(err, IsNil)
c.Assert(len(ctx.Providers), Equals, 1)
c.Assert(ctx.Providers[0].Name(), Equals, "vmware")
}