Skip to content

Instantly share code, notes, and snippets.

@duketon
Created April 21, 2015 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duketon/9c2ec7c74af2c7fc4050 to your computer and use it in GitHub Desktop.
Save duketon/9c2ec7c74af2c7fc4050 to your computer and use it in GitHub Desktop.
package com.ticketfly.promotersuite.authentication
import com.ticketfly.gatling.setup.HttpProtocol
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class OAuth extends Simulation with HttpProtocol {
val scn =
scenario("OAuth authentication")
.exec(http("init")
.get("https://promotersuite-test.dev.evojam.com/api/ps/oauth/init")
.check(headerRegex("Location", "(?<=token=).*").saveAs("token"))
.check(header("Location").saveAs("providerUrl"))
.check(status is 307))
.exec(http("go to oauth provider")
.get("${providerUrl}")
.check(status is 302))
.exec(http("submit credentials")
.post("https://dev03.ticketfly.com/account/auth")
.formParamMap(data)
.check(status is 302)
.check(header("Location").saveAs("resultUrl")))
.exec(http("authenticate")
.get("${resultUrl}")
.check(status is 302)
.check(header("Location").saveAs("callbackToApi")))
.exec(http("follow callback to api")
.get("${callbackToApi}")
.check(status is 307)
.check(header("Location").saveAs("redirectUrl")))
.exec(http("go to redirect")
.get("${redirectUrl}")
.check(status is 200))
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment