github.com/hashicorp/vault/sdk@v0.11.0/helper/roottoken/otp_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package roottoken
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestBase64OTPGeneration(t *testing.T) {
    13  	token, err := GenerateOTP(0)
    14  	assert.Len(t, token, 24)
    15  	assert.Nil(t, err)
    16  }
    17  
    18  func TestBase62OTPGeneration(t *testing.T) {
    19  	token, err := GenerateOTP(20)
    20  	assert.Len(t, token, 20)
    21  	assert.Nil(t, err)
    22  }