github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/pkg/redact/redact_test.go (about) 1 // Copyright 2021 PingCAP, Inc. Licensed under Apache-2.0. 2 3 package redact_test 4 5 import ( 6 "testing" 7 8 . "github.com/pingcap/check" 9 10 "github.com/pingcap/br/pkg/redact" 11 ) 12 13 type testRedactSuite struct{} 14 15 func (s *testRedactSuite) SetUpSuite(c *C) {} 16 func (s *testRedactSuite) TearDownSuite(c *C) {} 17 18 var _ = Suite(&testRedactSuite{}) 19 20 func TestT(t *testing.T) {} 21 22 func (s *testRedactSuite) TestRedact(c *C) { 23 redacted, secret := "?", "secret" 24 25 redact.InitRedact(false) 26 c.Assert(redact.String(secret), Equals, secret) 27 c.Assert(redact.Key([]byte(secret)), Equals, secret) 28 29 redact.InitRedact(true) 30 c.Assert(redact.String(secret), Equals, redacted) 31 c.Assert(redact.Key([]byte(secret)), Equals, redacted) 32 }