github.com/psyb0t/mattermost-server@v4.6.1-0.20180125161845-5503a1351abf+incompatible/api/context_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package api
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestSiteURLHeader(t *testing.T) {
    11  	c := &Context{}
    12  
    13  	testCases := []struct {
    14  		url  string
    15  		want string
    16  	}{
    17  		{"http://mattermost.com/", "http://mattermost.com"},
    18  		{"http://mattermost.com", "http://mattermost.com"},
    19  	}
    20  
    21  	for _, tc := range testCases {
    22  		c.SetSiteURLHeader(tc.url)
    23  
    24  		if c.siteURLHeader != tc.want {
    25  			t.Fatalf("expected %s, got %s", tc.want, c.siteURLHeader)
    26  		}
    27  	}
    28  
    29  }