summaryrefslogtreecommitdiffstats
path: root/model/saml_test.go
blob: d7745bd6bcaa65f19530fcc47cbc177832104453 (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-present 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")
	}
}