<commit_before>require 'gds_api/test_helpers/json_client_helper'

module GdsApi
  module TestHelpers
    module ContentApi
      CONTENT_API_ENDPOINT = 'https://contentapi.test.alphagov.co.uk'

      def content_api_has_root_sections(slugs)
        body = plural_response_base.merge(
          "results" => slugs.map do |slug|
            {
              "id" => "http://contentapi.test.gov.uk/tags/#{slug}.json",
              "web_url" => "http://www.test.gov.uk/browse/#{slug}",
              "title" => slug.gsub("-", " ").capitalize,
              "details" => {
                "type" => "section",
                "description" => "#{slug} description"
              },
              "parent" => nil
            }
          end
        )
        url = "#{CONTENT_API_ENDPOINT}/tags.json?type=section"
        stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
      end

      private 
        def response_base
          {
            "_response_info" => {<commit_msg>Update contentapi stub<commit_after>require 'gds_api/test_helpers/json_client_helper'

module GdsApi
  module TestHelpers
    module ContentApi
      CONTENT_API_ENDPOINT = 'https://contentapi.test.alphagov.co.uk'

      def content_api_has_root_sections(slugs)
        body = plural_response_base.merge(
          "results" => slugs.map do |slug|
            {
              "id" => "http://contentapi.test.gov.uk/tags/#{CGI.escape(slug)}.json",
              "web_url" => nil,
              "title" => slug.gsub("-", " ").capitalize,
              "details" => {
                "type" => "section",
                "description" => "#{slug} description"
              },
              "parent" => nil,
              "content_with_tag" => {
                "id" => "http://contentapi.test.gov.uk/with_tag.json?tag=#{CGI.escape(slug)}",
                "web_url" => "http://www.test.gov.uk/browse/#{slug}"
              }
            }
          end
        )
        url = "#{CONTENT_API_ENDPOINT}/tags.json?type=section"
        stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
      end

      private 
        def response_base
          {
            "_response_info" => {
{'fraction_non_alphanumeric': 0.14498644986449866, 'fraction_numerical': 0.0027100271002710027, 'mean_word_length': 1.7967171717171717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6069192', 'n_tokens_mistral': 700, 'n_tokens_neox': 692, 'n_words': 101}