Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Unified Diff: server/prpc/error_test.go

Issue 1605363002: common/prpc, tools/cmd/cproto: prpc client (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: rebased and addressed comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/prpc/error.go ('k') | server/prpc/method.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/prpc/error_test.go
diff --git a/server/prpc/error_test.go b/server/prpc/error_test.go
index 43957cc67744155de3ffb15d592650f901255c1b..7b378b9e36eecb56d426122c548f949f5fcec458 100644
--- a/server/prpc/error_test.go
+++ b/server/prpc/error_test.go
@@ -5,49 +5,15 @@
package prpc
import (
- "fmt"
"net/http"
"testing"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
-
. "github.com/smartystreets/goconvey/convey"
)
func TestError(t *testing.T) {
t.Parallel()
- Convey("ErrorCode", t, func() {
- status := ErrorStatus(nil)
- So(status, ShouldEqual, http.StatusOK)
-
- status = ErrorStatus(grpc.Errorf(codes.NotFound, "Not found"))
- So(status, ShouldEqual, http.StatusNotFound)
-
- status = ErrorStatus(withStatus(fmt.Errorf(""), http.StatusBadRequest))
- So(status, ShouldEqual, http.StatusBadRequest)
-
- status = ErrorStatus(fmt.Errorf("unhandled"))
- So(status, ShouldEqual, http.StatusInternalServerError)
- })
-
- Convey("ErrorDesc", t, func() {
- So(ErrorDesc(nil), ShouldEqual, "")
-
- err := Errorf(http.StatusNotFound, "not found")
- So(ErrorDesc(err), ShouldEqual, "not found")
-
- err = grpc.Errorf(codes.NotFound, "not found")
- So(ErrorDesc(err), ShouldEqual, "not found")
-
- err = withStatus(grpc.Errorf(codes.NotFound, "not found"), http.StatusNotFound)
- So(ErrorDesc(err), ShouldEqual, "not found")
-
- err = fmt.Errorf("not found")
- So(ErrorDesc(err), ShouldEqual, "not found")
- })
-
Convey("withStatus", t, func() {
Convey("withStatus(nil, *) returns nil", func() {
So(withStatus(nil, http.StatusBadRequest), ShouldBeNil)
« no previous file with comments | « server/prpc/error.go ('k') | server/prpc/method.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698