From 3b6c7c42268ef6349f88f9a56c58d7b6573d4830 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 1 Apr 2016 20:18:58 +0200 Subject: Add rpc testing --- rpc_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 rpc_test.go diff --git a/rpc_test.go b/rpc_test.go new file mode 100644 index 0000000..6e23b45 --- /dev/null +++ b/rpc_test.go @@ -0,0 +1,23 @@ +package goxy + +import "testing" + +func TestErrNoHost(t *testing.T) { + e := Entry{ + Host: "http://whatever", + } + if err := add(e); err == nil || err.Error() != ErrNoHost.Error() { + t.Errorf("got %q expected %q", err, ErrNoHost) + } +} + +func TestErrNoCert(t *testing.T) { + e := Entry{ + Host: "https://whatever", + Upstream: "http://whateverelse", + Cert: []byte("dummy"), + } + if err := add(e); err == nil || err.Error() != ErrNoCert.Error() { + t.Errorf("got %q expected %q", err, ErrNoCert) + } +} -- cgit v1.2.3