github.com/wgh-/mattermost-server@v4.8.0-rc2+incompatible/model/saml_test.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"strings"
     8  	"testing"
     9  )
    10  
    11  func TestSamlCertificateStatusJson(t *testing.T) {
    12  	status := &SamlCertificateStatus{IdpCertificateFile: true, PrivateKeyFile: true, PublicCertificateFile: true}
    13  	json := status.ToJson()
    14  	rstatus := SamlCertificateStatusFromJson(strings.NewReader(json))
    15  
    16  	if status.IdpCertificateFile != rstatus.IdpCertificateFile {
    17  		t.Fatal("IdpCertificateFile do not match")
    18  	}
    19  
    20  	rstatus = SamlCertificateStatusFromJson(strings.NewReader("junk"))
    21  	if rstatus != nil {
    22  		t.Fatal("should be nil")
    23  	}
    24  }