github.com/spinnaker/spin@v1.30.0/config/auth/iap/user_iap_auth_helper_test.go (about) 1 // Copyright (c) 2018, Snap Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 package config 15 16 import ( 17 "testing" 18 ) 19 20 const ( 21 expectedOauthUrl = "https://accounts.google.com/o/oauth2/v2/auth?client_id=testClientId&redirect_uri=http%3A%2F%2Flocalhost%3A80&response_type=code&scope=openid+email&state=testClientState" 22 ) 23 24 func TestGetCorrectOauthUrlSuccessful(t *testing.T) { 25 clientId := "testClientId" 26 clientState := "testClientState" 27 port := 80 28 oauthUrl := oauthURL(clientId, clientState, port) 29 if oauthUrl != expectedOauthUrl { 30 t.Errorf("Invalid oauth url, \n Expected:\t%s \n Got:\t%s", expectedOauthUrl, oauthUrl) 31 } 32 }