summaryrefslogtreecommitdiffstats
path: root/model/saml_test.go
blob: 578e78da550c4bc17e6b0a5884d3df7b11be4d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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")
	}
}