This repository has been archived by the owner on May 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up, additional tests, add deprecation warning.
- Loading branch information
1 parent
71af89a
commit fee76cb
Showing
5 changed files
with
144 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,8 @@ services: | |
"credentials": { | ||
"CONSOLE_CLIENT_ID": "dashboard-local", | ||
"CONSOLE_CLIENT_SECRET": "notarealsecret", | ||
"CSRF_KEY": "notarealcsrfkey", | ||
"SESSION_AUTHENTICATION_KEY": "notarealsessionauthenticationkey", | ||
"CSRF_KEY": "00112233445566778899aabbccddeeff", | ||
"SESSION_AUTHENTICATION_KEY": "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
"SMTP_FROM": "[email protected]", | ||
"SMTP_HOST": "smtp.fake.com", | ||
"SMTP_PASS": "", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,25 @@ type initSettingsTest struct { | |
var initSettingsTests = []initSettingsTest{ | ||
{ | ||
testName: "Basic Valid Production CF Settings", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.SecureCookiesEnvVar: "1", | ||
helpers.TICSecretEnvVar: "tic", | ||
}, | ||
returnValueNull: true, | ||
}, | ||
{ | ||
testName: "Basic Valid Legacy Session Key CF Settings", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
|
@@ -37,129 +56,138 @@ var initSettingsTests = []initSettingsTest{ | |
{ | ||
testName: "Basic Valid Local CF Settings", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.SecureCookiesEnvVar: "0", | ||
helpers.LocalCFEnvVar: "1", | ||
helpers.TICSecretEnvVar: "tic", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.SecureCookiesEnvVar: "0", | ||
helpers.LocalCFEnvVar: "1", | ||
helpers.TICSecretEnvVar: "tic", | ||
}, | ||
returnValueNull: true, | ||
}, | ||
{ | ||
testName: "Basic Invalid Prod CF Settings", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.LocalCFEnvVar: "0", | ||
helpers.TICSecretEnvVar: "tic", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.LocalCFEnvVar: "0", | ||
helpers.TICSecretEnvVar: "tic", | ||
// Let SecureCookies Default to false (similar to what would happen in real life). | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Client ID check", | ||
envVars: map[string]string{ | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Client Secret check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Hostname check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Auth URL check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Token URL check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing API URL check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.LogURLEnvVar: "logurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing Log URL check", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
|
@@ -178,27 +206,29 @@ var initSettingsTests = []initSettingsTest{ | |
{ | ||
testName: "Missing SMTP From", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LegacySessionKeyEnvVar: "blah", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
{ | ||
testName: "Missing SMTP Host", | ||
envVars: map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.LegacySessionKeyEnvVar: "blah", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "hostname", | ||
helpers.LoginURLEnvVar: "loginurl", | ||
helpers.UAAURLEnvVar: "uaaurl", | ||
helpers.APIURLEnvVar: "apiurl", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
}, | ||
returnValueNull: false, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,20 +238,21 @@ type BasicProxyTest struct { | |
// GetMockCompleteEnvVars is just a commonly used env vars object that contains non-empty values for all the fields of the EnvVars struct. | ||
func GetMockCompleteEnvVars() map[string]string { | ||
return map[string]string{ | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "https://hostname", | ||
helpers.LoginURLEnvVar: "https://loginurl", | ||
helpers.UAAURLEnvVar: "https://uaaurl", | ||
helpers.APIURLEnvVar: "https://apiurl", | ||
helpers.LogURLEnvVar: "https://logurl", | ||
helpers.PProfEnabledEnvVar: "true", | ||
helpers.LegacySessionKeyEnvVar: "lalala", | ||
helpers.BasePathEnvVar: os.Getenv(helpers.BasePathEnvVar), | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.SecureCookiesEnvVar: "1", | ||
helpers.TICSecretEnvVar: "tic", | ||
helpers.ClientIDEnvVar: "ID", | ||
helpers.ClientSecretEnvVar: "Secret", | ||
helpers.HostnameEnvVar: "https://hostname", | ||
helpers.LoginURLEnvVar: "https://loginurl", | ||
helpers.UAAURLEnvVar: "https://uaaurl", | ||
helpers.APIURLEnvVar: "https://apiurl", | ||
helpers.LogURLEnvVar: "https://logurl", | ||
helpers.PProfEnabledEnvVar: "true", | ||
helpers.SessionAuthenticationEnvVar: "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff", | ||
helpers.CSRFKeyEnvVar: "00112233445566778899aabbccddeeff", | ||
helpers.BasePathEnvVar: os.Getenv(helpers.BasePathEnvVar), | ||
helpers.SMTPFromEnvVar: "[email protected]", | ||
helpers.SMTPHostEnvVar: "localhost", | ||
helpers.SecureCookiesEnvVar: "1", | ||
helpers.TICSecretEnvVar: "tic", | ||
} | ||
} | ||
|
||
|