Module: GdsApi::TestHelpers::PerformancePlatform::DataIn

Defined in:
lib/gds_api/test_helpers/performance_platform/data_in.rb

Constant Summary collapse

PP_DATA_IN_ENDPOINT =
"http://www.performance.dev.gov.uk".freeze

Instance Method Summary collapse

Instance Method Details

#stub_corporate_content_problem_report_count_submission(submissions = nil) ⇒ Object


13
14
15
16
17
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 13

def stub_corporate_content_problem_report_count_submission(submissions = nil)
  post_stub = stub_http_request(:post, "#{PP_DATA_IN_ENDPOINT}/data/gov-uk-content/feedback-count")
  post_stub.with(body: submissions.to_json) unless submissions.nil?
  post_stub.to_return(status: 200)
end

#stub_corporate_content_urls_with_the_most_problem_reports_submission(submissions = nil) ⇒ Object


19
20
21
22
23
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 19

def stub_corporate_content_urls_with_the_most_problem_reports_submission(submissions = nil)
  post_stub = stub_http_request(:post, "#{PP_DATA_IN_ENDPOINT}/data/gov-uk-content/top-urls")
  post_stub.with(body: submissions.to_json) unless submissions.nil?
  post_stub.to_return(status: 200)
end

#stub_pp_dataset_unavailableObject


39
40
41
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 39

def stub_pp_dataset_unavailable
  stub_request(:any, /#{PP_DATA_IN_ENDPOINT}/).to_return(status: 404)
end

#stub_pp_isnt_availableObject


35
36
37
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 35

def stub_pp_isnt_available
  stub_request(:post, /#{PP_DATA_IN_ENDPOINT}\/.*/).to_return(status: 503)
end

#stub_problem_report_daily_totals_submission(submissions = nil) ⇒ Object


25
26
27
28
29
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 25

def stub_problem_report_daily_totals_submission(submissions = nil)
  post_stub = stub_http_request(:post, "#{PP_DATA_IN_ENDPOINT}/data/govuk-info/page-contacts")
  post_stub.with(body: submissions.to_json) unless submissions.nil?
  post_stub.to_return(status: 200)
end

#stub_service_feedback_bucket_unavailable_for(slug) ⇒ Object


31
32
33
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 31

def stub_service_feedback_bucket_unavailable_for(slug)
  stub_request(:post, "#{PP_DATA_IN_ENDPOINT}/data/#{slug}/customer-satisfaction").to_return(status: 404)
end

#stub_service_feedback_day_aggregate_submission(slug, request_body = nil) ⇒ Object


7
8
9
10
11
# File 'lib/gds_api/test_helpers/performance_platform/data_in.rb', line 7

def stub_service_feedback_day_aggregate_submission(slug, request_body = nil)
  post_stub = stub_http_request(:post, "#{PP_DATA_IN_ENDPOINT}/data/#{slug}/customer-satisfaction")
  post_stub.with(body: request_body) unless request_body.nil?
  post_stub.to_return(status: 200)
end