Esempio n. 1
0
func (s *DownloadSuite) TestDownloadIndirectOkay(c *gc.C) {
	stub := &stubDownload{
		internalStub: s.stub,
	}
	stub.ReturnNewTempDirSpec = stub
	stub.ReturnResolve = []string{
		"/tmp/xyz/eggs",
		"/var/lib/juju/agents/unit-spam-1/resources/eggs",
	}
	target := stub
	remote := stub
	deps := stub

	err := internal.DownloadIndirect(target, remote, deps)
	c.Assert(err, jc.ErrorIsNil)

	s.stub.CheckCallNames(c,
		"NewTempDirSpec",
		"DownloadDirect",
		"Initialize",
		"Resolve",
		"Resolve",
		"ReplaceDirectory",
		"CloseAndLog",
	)
	s.stub.CheckCall(c, 1, "DownloadDirect", stub, remote)
}
Esempio n. 2
0
func (s *DownloadSuite) TestDownloadIndirectTempDirFailure(c *gc.C) {
	stub := &stubDownload{
		internalStub: s.stub,
	}
	stub.ReturnNewTempDirSpec = stub
	failure := errors.New("<failure>")
	stub.SetErrors(failure)
	target := stub
	remote := stub
	deps := stub

	err := internal.DownloadIndirect(target, remote, deps)

	c.Check(errors.Cause(err), gc.Equals, failure)
	s.stub.CheckCallNames(c,
		"NewTempDirSpec",
		"CloseAndLog",
	)
}
Esempio n. 3
0
func (deps *contextDeps) Download(target internal.DownloadTarget, remote internal.ContextOpenedResource) error {
	return internal.DownloadIndirect(target, remote, deps)
}