vikunja-api/pkg/utils/sha256_test.go

54 lines
1.6 KiB
Go
Raw Normal View History

2020-02-07 17:27:45 +01:00
// Vikunja is a to-do list application to facilitate your life.
2020-01-09 18:33:22 +01:00
// Copyright 2018-2020 Vikunja and contributors. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
2020-12-23 16:41:52 +01:00
// it under the terms of the GNU Affero General Public Licensee as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2020-12-23 16:41:52 +01:00
// GNU Affero General Public Licensee for more details.
//
2020-12-23 16:41:52 +01:00
// You should have received a copy of the GNU Affero General Public Licensee
// along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-12-16 14:21:32 +01:00
package utils
import "testing"
func TestSha256(t *testing.T) {
type args struct {
cleartext string
}
tests := []struct {
name string
args args
want string
}{
{
name: "Test sha256 generation",
args: args{cleartext: "vikunjarandomstringwhichisnotrandom"},
want: "46fc0f603dd986cf7ed3e631917d43da89a8df2bdf291",
},
{
name: "Test sha256 generation",
args: args{cleartext: "vikunjastring"},
want: "f54d310f4d9a0bc13479dad5c5701e8d581744666b69f",
},
{
name: "Test sha256 generation",
args: args{cleartext: "somethingsomething"},
want: "00aef67d6df7fdee0419aa3713820e7084cbcb8b8f7c4",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Sha256(tt.args.cleartext); got != tt.want {
t.Errorf("Sha256() = %v, want %v", got, tt.want)
}
})
}
}