示例#1
0
func (s *connSuite) TestConnectionDisk(c *gc.C) {
	_, fakeDisk, err := fakeDiskAndSpec()
	c.Check(err, jc.ErrorIsNil)
	s.FakeConn.Disk = fakeDisk
	disk, err := s.Conn.Disk("home-zone", fakeVolName)
	c.Check(err, jc.ErrorIsNil)
	fakeGoogleDisk := google.NewDisk(fakeDisk)
	c.Assert(disk, gc.DeepEquals, fakeGoogleDisk)

	c.Check(s.FakeConn.Calls, gc.HasLen, 1)
	c.Check(s.FakeConn.Calls[0].FuncName, gc.Equals, "GetDisk")
	c.Check(s.FakeConn.Calls[0].ProjectID, gc.Equals, "spam")
	c.Check(s.FakeConn.Calls[0].ZoneName, gc.Equals, "home-zone")
}
示例#2
0
func (s *connSuite) TestConnectionDisks(c *gc.C) {
	_, fakeDisk, err := fakeDiskAndSpec()
	c.Check(err, jc.ErrorIsNil)
	s.FakeConn.Disks = []*compute.Disk{fakeDisk}

	disks, err := s.Conn.Disks("home-zone")
	c.Check(err, jc.ErrorIsNil)
	c.Assert(disks, gc.HasLen, 1)
	fakeGoogleDisk := google.NewDisk(fakeDisk)
	c.Assert(disks[0], gc.DeepEquals, fakeGoogleDisk)

	c.Check(s.FakeConn.Calls, gc.HasLen, 1)
	c.Check(s.FakeConn.Calls[0].FuncName, gc.Equals, "ListDisks")
	c.Check(s.FakeConn.Calls[0].ProjectID, gc.Equals, "spam")
	c.Check(s.FakeConn.Calls[0].ZoneName, gc.Equals, "home-zone")
}