diff options
Diffstat (limited to 'model/saml_test.go')
-rw-r--r-- | model/saml_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/model/saml_test.go b/model/saml_test.go new file mode 100644 index 000000000..578e78da5 --- /dev/null +++ b/model/saml_test.go @@ -0,0 +1,24 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package model + +import ( + "strings" + "testing" +) + +func TestSamlCertificateStatusJson(t *testing.T) { + status := &SamlCertificateStatus{IdpCertificateFile: true, PrivateKeyFile: true, PublicCertificateFile: true} + json := status.ToJson() + rstatus := SamlCertificateStatusFromJson(strings.NewReader(json)) + + if status.IdpCertificateFile != rstatus.IdpCertificateFile { + t.Fatal("IdpCertificateFile do not match") + } + + rstatus = SamlCertificateStatusFromJson(strings.NewReader("junk")) + if rstatus != nil { + t.Fatal("should be nil") + } +} |