github.com/kubernetes-incubator/kube-aws@v0.16.4/filereader/texttemplate/texttemplate_test.go (about)

     1  package texttemplate
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  var tolabelFunc = funcs2["toLabel"].(func(string) string)
    10  
    11  func TestCIDRToLabel(t *testing.T) {
    12  
    13  	data := "192.168.0.0/16"
    14  	label := tolabelFunc(data)
    15  
    16  	assert.Equal(t, "192.168.0.0_16", label)
    17  }
    18  
    19  func TestMultipleSymbolsToReplace(t *testing.T) {
    20  
    21  	data := "https://kubernetes.io/docs/admin/authorization/rbac/#referring-to-subjects"
    22  	label := tolabelFunc(data)
    23  
    24  	assert.Equal(t, "https___kubernetes.io_docs_admin_authorization_rbac__referring-to-subjects", label)
    25  }