github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/wordsmith/utility/secrets_test.go (about) 1 // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. 2 // 3 // This software (Documize Community Edition) is licensed under 4 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html 5 // 6 // You can operate outside the AGPL restrictions by purchasing 7 // Documize Enterprise Edition and obtaining a commercial license 8 // by contacting <sales@documize.com>. 9 // 10 // https://documize.com 11 12 package utility 13 14 import "testing" 15 16 func TestSecrets(t *testing.T) { 17 mimi := "007" 18 b, e := MakeAES(mimi) 19 if e != nil { 20 t.Fatal(e) 21 } 22 mm, e2 := DecryptAES(b) 23 if e2 != nil { 24 t.Fatal(e2) 25 } 26 if mimi != string(mm) { 27 t.Errorf("wanted %s got %s", mimi, string(mm)) 28 } 29 30 _, ee := DecryptAES([]byte{}) 31 if ee == nil { 32 t.Error("should have errored on empty cypher") 33 } 34 35 }