Exemple #1
0
func (s *UtilsSuite) newReader(c *gc.C, content string) (io.ReadCloser, charmresource.Fingerprint) {
	r := filetesting.NewStubFile(s.stub, bytes.NewBufferString(content))

	tmpReader := strings.NewReader(content)
	fp, err := charmresource.GenerateFingerprint(tmpReader)
	c.Assert(err, jc.ErrorIsNil)

	return r, fp
}
Exemple #2
0
func (s *UnitFacadeClientSuite) TestUnitDoer(c *gc.C) {
	req, err := http.NewRequest("GET", "/resources/eggs", nil)
	c.Assert(err, jc.ErrorIsNil)
	body := filetesting.NewStubFile(s.stub, nil)
	var resp *http.Response
	doer := client.NewUnitHTTPClient(s.api, "spam/1")

	err = doer.Do(req, body, &resp)
	c.Assert(err, jc.ErrorIsNil)

	s.stub.CheckCallNames(c, "Do")
	//s.stub.CheckCall(c, 0, "Do", expected, body, resp)
	c.Check(req.URL.Path, gc.Equals, "/units/spam/1/resources/eggs")
}