-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1290 from alphagov/add-graphql-client
Add GraphQL endpoint for Publishing API
- Loading branch information
Showing
6 changed files
with
95 additions
and
2 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module GdsApi | ||
VERSION = "97.0.0".freeze | ||
VERSION = "97.1.0".freeze | ||
end |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "test_helper" | ||
require "gds_api/publishing_api" | ||
|
||
describe "GdsApi::PublishingApi#graphql_query pact tests" do | ||
include PactTest | ||
|
||
let(:api_client) { GdsApi::PublishingApi.new(publishing_api_host) } | ||
|
||
it "returns the response to the query" do | ||
query = <<~QUERY | ||
{ | ||
edition(basePath: "/my-document") { | ||
... on Edition { | ||
title | ||
} | ||
} | ||
} | ||
QUERY | ||
|
||
publishing_api | ||
.given("a published content item exists with base_path /my-document") | ||
.upon_receiving("a GraphQL request") | ||
.with( | ||
method: :post, | ||
path: "/graphql", | ||
body: { query: }, | ||
headers: GdsApi::JsonClient.default_request_with_json_body_headers, | ||
) | ||
.will_respond_with( | ||
status: 200, | ||
body: { | ||
"data": { | ||
"edition": { | ||
"title": "My document", | ||
}, | ||
}, | ||
}, | ||
) | ||
|
||
api_client.graphql_query(query) | ||
end | ||
end |
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