예제 #1
0
func (s *S) TestGetCACertWithoutAuth(c *C) {
	client, err := controller.NewClient(s.srv.URL, "")
	c.Assert(err, IsNil)
	cert, err := client.GetCACert()
	c.Assert(err, IsNil)
	c.Assert(cert, DeepEquals, s.caCert)
}
예제 #2
0
func (s *S) TestGetCACertWithInvalidAuth(c *C) {
	client, err := controller.NewClient(s.srv.URL, "invalid-key")
	c.Assert(err, IsNil)
	cert, err := client.GetCACert()
	c.Assert(err, Not(IsNil))
	c.Assert(len(cert), Equals, 0)
	c.Assert(strings.Contains(err.Error(), "unexpected status 401"), Equals, true)
}