Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
test: add some unit test cases for pkg/errortypes/errortypes.go
Browse files Browse the repository at this point in the history
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
  • Loading branch information
hs0210 committed Jun 8, 2020
1 parent ed1145f commit ea73b4f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/errortypes/errortypes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,19 @@ func (suite *ErrorTestSuite) TestIsRangeNotSatisfiable(c *check.C) {
c.Assert(IsRangeNotSatisfiable(*err1), check.Equals, true)
c.Assert(IsRangeNotSatisfiable(*err2), check.Equals, false)
}

func (suite *ErrorTestSuite) TestNewHTTPError(c *check.C) {
err := NewHTTPError(1, "test")
c.Assert(err.Code, check.Equals, 1)
c.Assert(err.Msg, check.Equals, "test")
}

func (suite *ErrorTestSuite) TestHTTPError(c *check.C) {
err := NewHTTPError(1, "test")
c.Assert(err.Error(), check.Equals, "{\"Code\":1,\"Msg\":\"test\"}")
}

func (suite *ErrorTestSuite) TestHTTPCode(c *check.C) {
err := NewHTTPError(1, "test")
c.Assert(err.HTTPCode(), check.Equals, 1)
}

0 comments on commit ea73b4f

Please sign in to comment.