Move scenario to json files

This commit is contained in:
Liam Newman
2019-08-31 19:52:50 -07:00
parent 12230edc54
commit 450261abbf
6 changed files with 121 additions and 28 deletions

View File

@@ -38,32 +38,6 @@ public class GistTest extends AbstractGitHubApiWireMockTest {
@Test
public void starTest() throws Exception {
githubApi.stubFor(
put(urlEqualTo("/gists/9903708/star"))
.inScenario("Star Test")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(
noContent())
.willSetStateTo("Starred"));
githubApi.stubFor(
get(urlEqualTo("/gists/9903708/star"))
.inScenario("Star Test")
.whenScenarioStateIs("Starred")
.willReturn(
noContent())
.willSetStateTo("Starred"));
githubApi.stubFor(
delete(urlEqualTo("/gists/9903708/star"))
.inScenario("Star Test")
.whenScenarioStateIs("Starred")
.willReturn(
noContent())
.willSetStateTo("UnStarred"));
GHGist gist = gitHub.getGist("9903708");
assertEquals("rtyler",gist.getOwner().getLogin());

View File

@@ -0,0 +1,37 @@
{
"id" : "1c70c95a-e70e-3157-b42e-421eaca2c55e",
"scenarioName": "Star Test",
"requiredScenarioState": "Gist Starred",
"newScenarioState": "Started",
"request" : {
"url" : "/gists/9903708/star",
"method" : "DELETE"
},
"response" : {
"status" : 204,
"body" : "",
"headers" : {
"Date" : "Sun, 01 Sep 2019 02:41:15 GMT",
"Content-Type" : "application/octet-stream",
"Server" : "GitHub.com",
"Status" : "204 No Content",
"X-RateLimit-Limit" : "5000",
"X-RateLimit-Remaining" : "4997",
"X-RateLimit-Reset" : "1567308919",
"X-OAuth-Scopes" : "gist, notifications, repo",
"X-Accepted-OAuth-Scopes" : "",
"X-GitHub-Media-Type" : "unknown, github.v3",
"Access-Control-Expose-Headers" : "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin" : "*",
"Strict-Transport-Security" : "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options" : "deny",
"X-Content-Type-Options" : "nosniff",
"X-XSS-Protection" : "1; mode=block",
"Referrer-Policy" : "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy" : "default-src 'none'",
"Vary" : "Accept-Encoding",
"X-GitHub-Request-Id" : "E77B:467A:1A705CB:1F4E173:5D6B2FCB"
}
},
"uuid" : "1c70c95a-e70e-3157-b42e-421eaca2c55e"
}

View File

@@ -0,0 +1,39 @@
{
"id" : "2973a1c9-ee7a-3b76-bdc9-fa3130166690",
"scenarioName": "Star Test",
"requiredScenarioState": "Gist Starred",
"request" : {
"url" : "/gists/9903708/star",
"method" : "GET"
},
"response" : {
"status" : 204,
"body" : "",
"headers" : {
"Date" : "Sun, 01 Sep 2019 02:41:15 GMT",
"Content-Type" : "application/octet-stream",
"Server" : "GitHub.com",
"Status" : "204 No Content",
"X-RateLimit-Limit" : "5000",
"X-RateLimit-Remaining" : "4998",
"X-RateLimit-Reset" : "1567308919",
"Cache-Control" : "private, max-age=60, s-maxage=60",
"Vary" : [ "Accept, Authorization, Cookie, X-GitHub-OTP", "Accept-Encoding" ],
"ETag" : "\"edb05f57c2fc5ae1ea30b0bb50a09f48\"",
"Last-Modified" : "Sun, 01 Sep 2019 02:35:19 GMT",
"X-OAuth-Scopes" : "gist, notifications, repo",
"X-Accepted-OAuth-Scopes" : "",
"X-GitHub-Media-Type" : "unknown, github.v3",
"Access-Control-Expose-Headers" : "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin" : "*",
"Strict-Transport-Security" : "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options" : "deny",
"X-Content-Type-Options" : "nosniff",
"X-XSS-Protection" : "1; mode=block",
"Referrer-Policy" : "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy" : "default-src 'none'",
"X-GitHub-Request-Id" : "E77B:467A:1A705C3:1F4E16D:5D6B2FCB"
}
},
"uuid" : "2973a1c9-ee7a-3b76-bdc9-fa3130166690"
}

View File

@@ -0,0 +1,42 @@
{
"id" : "725fe929-9ea9-355d-bfe9-89f8bf7a9bb2",
"scenarioName": "Star Test",
"requiredScenarioState": "Started",
"newScenarioState": "Gist Starred",
"request" : {
"url" : "/gists/9903708/star",
"method" : "PUT",
"bodyPatterns" : [ {
"equalToJson" : "{}",
"ignoreArrayOrder" : true,
"ignoreExtraElements" : true
} ]
},
"response" : {
"status" : 204,
"body" : "",
"headers" : {
"Date" : "Sun, 01 Sep 2019 02:35:19 GMT",
"Content-Type" : "application/octet-stream",
"Server" : "GitHub.com",
"Status" : "204 No Content",
"X-RateLimit-Limit" : "5000",
"X-RateLimit-Remaining" : "4999",
"X-RateLimit-Reset" : "1567308919",
"X-OAuth-Scopes" : "gist, notifications, repo",
"X-Accepted-OAuth-Scopes" : "",
"X-GitHub-Media-Type" : "unknown, github.v3",
"Access-Control-Expose-Headers" : "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
"Access-Control-Allow-Origin" : "*",
"Strict-Transport-Security" : "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options" : "deny",
"X-Content-Type-Options" : "nosniff",
"X-XSS-Protection" : "1; mode=block",
"Referrer-Policy" : "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy" : "default-src 'none'",
"Vary" : "Accept-Encoding",
"X-GitHub-Request-Id" : "E74D:9A51:1AEB246:1F93AB5:5D6B2E67"
}
},
"uuid" : "725fe929-9ea9-355d-bfe9-89f8bf7a9bb2"
}

View File

@@ -1,12 +1,14 @@
{
"id" : "ffac033c-525e-3a55-993c-14b629e4ceaf",
"scenarioName": "Star Test",
"requiredScenarioState": "Started",
"request" : {
"url" : "/gists/9903708/star",
"method" : "GET"
},
"response" : {
"status" : 404,
"bodyFileName" : "body-gists-9903708-unstarred.json",
"body" : "{}",
"headers" : {
"Date" : "Sat, 31 Aug 2019 07:00:18 GMT",
"Content-Type" : "application/json; charset=utf-8",