saml_test.go 649 Bytes
Newer Older
1
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// 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")
	}
}