github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/courier/swagger/gen/utils_test.go (about)

     1  package gen
     2  
     3  import (
     4  	"encoding/json"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  
     9  	"github.com/johnnyeven/libtools/courier"
    10  )
    11  
    12  func ToMap(schema interface{}) (result interface{}) {
    13  	bytes, _ := json.Marshal(schema)
    14  	json.Unmarshal(bytes, &result)
    15  	return
    16  }
    17  
    18  func TestParseSuccessMetadata(t *testing.T) {
    19  	tt := assert.New(t)
    20  	tt.Equal(ParseSuccessMetadata("@success content-type text/plain"), courier.Metadata{
    21  		"content-type": []string{"text/plain"},
    22  	})
    23  }