Created
April 21, 2015 12:24
-
-
Save duketon/9c2ec7c74af2c7fc4050 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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