File: errors_test.go

package info (click to toggle)
golang-gopkg-goose.v1 0.0~git20170406.3228e4f-6
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,116 kB
  • sloc: python: 160; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package testservices

import (
	"testing"

	gc "gopkg.in/check.v1"
)

func Test(t *testing.T) { gc.TestingT(t) }

type ErrorsSuite struct {
}

var _ = gc.Suite(&ErrorsSuite{})

func (s *ErrorsSuite) TestServerErrorMessage(c *gc.C) {
	err := &ServerError{
		message: "Instance could not be found",
		code:    404,
	}
	c.Assert(err, gc.ErrorMatches, "itemNotFound: Instance could not be found")
}

func (s *ErrorsSuite) TestServerUnknownErrcode(c *gc.C) {
	err := &ServerError{
		message: "Impossible http code.",
		code:    999,
	}
	c.Assert(err, gc.ErrorMatches, "computeFault: Impossible http code.")
}