func (s *AptSuite) TestAptProxyContentPartial(c *gc.C) { proxySettings := proxy.Settings{ Http: "[email protected]", } output := apt.ProxyContent(proxySettings) expected := `Acquire::http::Proxy "[email protected]";` c.Assert(output, gc.Equals, expected) }
func (s *AptSuite) TestAptProxyContentRoundtrip(c *gc.C) { proxySettings := proxy.Settings{ Http: "http://[email protected]", Https: "https://[email protected]", Ftp: "ftp://[email protected]", } output := apt.ProxyContent(proxySettings) s.HookCommandOutput(&apt.CommandOutput, []byte(output), nil) detected, err := apt.DetectProxies() c.Assert(err, gc.IsNil) c.Assert(detected, gc.DeepEquals, proxySettings) }
func (s *AptSuite) TestAptProxyContentEmpty(c *gc.C) { output := apt.ProxyContent(proxy.Settings{}) c.Assert(output, gc.Equals, "") }