Skip to content

Commit

Permalink
Clean up runner tests to include scheme in url
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardecook committed Sep 13, 2019
1 parent 4cac496 commit 4ee8f93
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cf/login_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("cf login runner", func() {
BeforeEach(func() {
scriptRunner = new(scriptingfakes.FakeScriptRunner)

url, _ := url.Parse("www.test-url.io")
url, _ := url.Parse("https://www.test-url.io")
data = environment.Config{
CFDomain: "sys.test-url.io",
OpsManager: environment.OpsManager{
Expand All @@ -60,9 +60,9 @@ var _ = Describe("cf login runner", func() {
lines, _, _ := scriptRunner.RunScriptArgsForCall(0)

Expect(lines).To(Equal([]string{
`prods="$(om -t www.test-url.io -k -u username -p password curl -s -p /api/v0/staged/products)"`,
`prods="$(om -t https://www.test-url.io -k -u username -p password curl -s -p /api/v0/staged/products)"`,
`guid="$(echo "$prods" | jq -r '.[] | select(.type == "cf") | .guid')"`,
`creds="$(om -t www.test-url.io -k -u username -p password curl -s -p /api/v0/deployed/products/"$guid"/credentials/.uaa.admin_credentials)"`, `user="$(echo "$creds" | jq -r .credential.value.identity)"`,
`creds="$(om -t https://www.test-url.io -k -u username -p password curl -s -p /api/v0/deployed/products/"$guid"/credentials/.uaa.admin_credentials)"`, `user="$(echo "$creds" | jq -r .credential.value.identity)"`,
`pass="$(echo "$creds" | jq -r .credential.value.password)"`,
`cf login -a "api.sys.test-url.io" -u "$user" -p "$pass" --skip-ssl-validation`,
}))
Expand Down
6 changes: 3 additions & 3 deletions om/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var _ = Describe("om runner", func() {
BeforeEach(func() {
scriptRunner = new(scriptingfakes.FakeScriptRunner)

url, _ := url.Parse("www.test-url.io")
url, _ := url.Parse("https://www.test-url.io")
data = environment.Config{
OpsManager: environment.OpsManager{
URL: *url,
Expand Down Expand Up @@ -64,7 +64,7 @@ var _ = Describe("om runner", func() {

lines, prereqs, _ := scriptRunner.RunScriptArgsForCall(0)
Expect(lines).To(Equal([]string{
`echo "export OM_TARGET=www.test-url.io"`,
`echo "export OM_TARGET=https://www.test-url.io"`,
`echo "export OM_USERNAME=username"`,
`echo "export OM_PASSWORD=password"`,
}))
Expand All @@ -86,7 +86,7 @@ var _ = Describe("om runner", func() {

lines, prereqs, _ := scriptRunner.RunScriptArgsForCall(0)
Expect(lines).To(Equal([]string{
`om -t 'www.test-url.io' -k -u 'username' -p 'password' 'arg1' 'arg2' 'arg3'`,
`om -t 'https://www.test-url.io' -k -u 'username' -p 'password' 'arg1' 'arg2' 'arg3'`,
}))
Expect(prereqs).To(ConsistOf("om"))
})
Expand Down
4 changes: 2 additions & 2 deletions open/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("open runner", func() {
BeforeEach(func() {
scriptRunner = new(scriptingfakes.FakeScriptRunner)

url, _ := url.Parse("www.test-url.io")
url, _ := url.Parse("https://www.test-url.io")
data = environment.Config{
OpsManager: environment.OpsManager{
URL: *url,
Expand All @@ -57,7 +57,7 @@ var _ = Describe("open runner", func() {

lines, _, _ := scriptRunner.RunScriptArgsForCall(0)
Expect(lines).To(Equal([]string{
`open "www.test-url.io"`,
`open "https://www.test-url.io"`,
`echo "password" | pbcopy`,
}))
})
Expand Down
6 changes: 3 additions & 3 deletions pks/login_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("pks login runner", func() {
BeforeEach(func() {
scriptRunner = new(scriptingfakes.FakeScriptRunner)

opsmanUrl, _ := url.Parse("www.test-url.io")
opsmanUrl, _ := url.Parse("https://www.test-url.io")
pksApiUrl, _ := url.Parse("api.test-url.io")
data = environment.Config{
OpsManager: environment.OpsManager{
Expand Down Expand Up @@ -65,9 +65,9 @@ var _ = Describe("pks login runner", func() {
lines, _, _ := scriptRunner.RunScriptArgsForCall(0)

Expect(lines).To(Equal([]string{
`prods="$(om -t www.test-url.io -k -u username -p password curl -s -p /api/v0/staged/products)"`,
`prods="$(om -t https://www.test-url.io -k -u username -p password curl -s -p /api/v0/staged/products)"`,
`guid="$(echo "$prods" | jq -r '.[] | select(.type == "pivotal-container-service") | .guid')"`,
`creds="$(om -t www.test-url.io -k -u username -p password curl -s -p /api/v0/deployed/products/"$guid"/credentials/.properties.uaa_admin_password)"`,
`creds="$(om -t https://www.test-url.io -k -u username -p password curl -s -p /api/v0/deployed/products/"$guid"/credentials/.properties.uaa_admin_password)"`,
`pass="$(echo "$creds" | jq -r .credential.value.secret)"`,
`pks login -a api.test-url.io -u admin -p "$pass" --skip-ssl-validation`,
}))
Expand Down

0 comments on commit 4ee8f93

Please sign in to comment.