~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/gopkg.in/goose.v1/testservices/errors_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package testservices
 
2
 
 
3
import (
 
4
        "testing"
 
5
 
 
6
        gc "gopkg.in/check.v1"
 
7
)
 
8
 
 
9
func Test(t *testing.T) { gc.TestingT(t) }
 
10
 
 
11
type ErrorsSuite struct {
 
12
}
 
13
 
 
14
var _ = gc.Suite(&ErrorsSuite{})
 
15
 
 
16
func (s *ErrorsSuite) TestServerErrorMessage(c *gc.C) {
 
17
        err := &ServerError{
 
18
                message: "Instance could not be found",
 
19
                code:    404,
 
20
        }
 
21
        c.Assert(err, gc.ErrorMatches, "itemNotFound: Instance could not be found")
 
22
}
 
23
 
 
24
func (s *ErrorsSuite) TestServerUnknownErrcode(c *gc.C) {
 
25
        err := &ServerError{
 
26
                message: "Impossible http code.",
 
27
                code:    999,
 
28
        }
 
29
        c.Assert(err, gc.ErrorMatches, "computeFault: Impossible http code.")
 
30
}