From fcafd4e8f81b7a256fbea1e120be6ead9e2425d3 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 17 May 2017 13:28:22 +0200 Subject: [PATCH] test case for email --- app/router/condition_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/router/condition_test.go b/app/router/condition_test.go index 0d0df3e4..1101da1f 100644 --- a/app/router/condition_test.go +++ b/app/router/condition_test.go @@ -6,6 +6,7 @@ import ( . "v2ray.com/core/app/router" "v2ray.com/core/common/net" + "v2ray.com/core/common/protocol" "v2ray.com/core/proxy" "v2ray.com/core/testing/assert" ) @@ -126,6 +127,23 @@ func TestRoutingRule(t *testing.T) { }, }, }, + { + rule: &RoutingRule{ + UserEmail: []string{ + "admin@v2ray.com", + }, + }, + test: []ruleTest{ + ruleTest{ + input: protocol.ContextWithUser(context.Background(), &protocol.User{Email: "admin@v2ray.com"}), + output: true, + }, + ruleTest{ + input: protocol.ContextWithUser(context.Background(), &protocol.User{Email: "love@v2ray.com"}), + output: false, + }, + }, + }, } for _, test := range cases {