github.com/adacta-ru/mattermost-server/v6@v6.0.0/model/mfa_secret_test.go (about)

     1  // Copyright (c) 2015-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  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestMfaSecretJson(t *testing.T) {
    14  	secret := MfaSecret{Secret: NewId(), QRCode: NewId()}
    15  	json := secret.ToJson()
    16  	result := MfaSecretFromJson(strings.NewReader(json))
    17  
    18  	require.Equal(t, secret.Secret, result.Secret, "Secrets do not match")
    19  }