github.com/jcmturner/gokrb5/v8@v8.4.4/credentials/credentials_test.go (about)

     1  package credentials
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/jcmturner/goidentity/v6"
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestImplementsInterface(t *testing.T) {
    11  	t.Parallel()
    12  	u := new(Credentials)
    13  	i := new(goidentity.Identity)
    14  	assert.Implements(t, i, u, "Credentials type does not implement the Identity interface")
    15  }
    16  
    17  func TestCredentials_Marshal(t *testing.T) {
    18  	var cred Credentials
    19  	b, err := cred.Marshal()
    20  	if err != nil {
    21  		t.Fatalf("could not marshal credetials: %v", err)
    22  	}
    23  	var credum Credentials
    24  	err = credum.Unmarshal(b)
    25  	if err != nil {
    26  		t.Fatalf("could not unmarshal credetials: %v", err)
    27  	}
    28  }