github.com/mattermost/mattermost-server/v5@v5.39.3/store/storetest/utils.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package storetest
     5  
     6  import (
     7  	"github.com/mattermost/mattermost-server/v5/model"
     8  )
     9  
    10  // This function has a copy of it in app/helper_test
    11  // NewTestId is used for testing as a replacement for model.NewId(). It is a [A-Z0-9] string 26
    12  // characters long. It replaces every odd character with a digit.
    13  func NewTestId() string {
    14  	newId := []byte(model.NewId())
    15  
    16  	for i := 1; i < len(newId); i = i + 2 {
    17  		newId[i] = 48 + newId[i-1]%10
    18  	}
    19  
    20  	return string(newId)
    21  }