Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .review_apps/ecs_task_definition.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ locals {
{ name = "SETTINGS__ANALYTICS_ENABLED", value = "false" },
{ name = "SETTINGS__CLOUDWATCH_METRICS_ENABLED", value = "false" },
{ name = "SETTINGS__FORMS_ADMIN__BASE_URL", value = "https://${local.admin_app_hostname}" },
{ name = "SETTINGS__FORMS_API__AUTH_KEY", value = "unsecured_api_key_for_review_apps_only" },
{ name = "SETTINGS__FORMS_API__BASE_URL", value = "http://localhost:9292" },
{ name = "SETTINGS__FORMS_ENV", value = "review" },

Expand All @@ -40,7 +39,6 @@ locals {
{ name = "RAILS_DEVELOPMENT_HOSTS", value = "localhost:9292" },
{ name = "RAILS_ENV", value = "production" },
{ name = "SECRET_KEY_BASE", value = "unsecured_secret_key_material" },
{ name = "SETTINGS__FORMS_API__AUTH_KEY", value = "unsecured_api_key_for_review_apps_only" },
{ name = "SETTINGS__FORMS_ENV", value = "review" },
]

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gem "tzinfo-data"
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# For forms-api
# For requests to the forms-admin API
gem "activeresource"

# Use postgresql as the database for Active Record
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ or run the rails server:
npm run dev
```

You will also need to run the [forms-api service](https://github.com/alphagov/forms-api), as this app needs the API to create and access forms.
You will also need to run the [forms-admin service](https://github.com/alphagov/forms-admin), as this app needs the API to create and access forms.

#### Getting AWS credentials

Expand Down
1 change: 0 additions & 1 deletion app/resources/api/v2/form_document_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class Api::V2::FormDocumentResource < ActiveResource::Base
self.site = Settings.forms_api.base_url
self.prefix = "/api/v2/"
self.include_format_in_path = false
headers["X-API-Token"] = Settings.forms_api.auth_key

class Step < ActiveResource::Base
self.site = Settings.forms_api.base_url
Expand Down
6 changes: 2 additions & 4 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ forms_admin:
base_url: http://localhost:3000

forms_api:
# Authentication key to authenticate forms-runner to forms-api
auth_key: development_key
# URL to form-api endpoints
base_url: http://localhost:9292
# URL to form-admin API endpoints
base_url: http://localhost:3000

# Settings for GOV.UK Notify api & email templates
govuk_notify:
Expand Down
3 changes: 1 addition & 2 deletions spec/config/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
describe ".forms_api" do
forms_api = settings[:forms_api]

include_examples expected_value_test, :auth_key, forms_api, "development_key"
include_examples expected_value_test, :base_url, forms_api, "http://localhost:9292"
include_examples expected_value_test, :base_url, forms_api, "http://localhost:3000"
end

describe ".govuk_notify" do
Expand Down
14 changes: 2 additions & 12 deletions spec/features/email_confirmation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@
let(:question_text) { Faker::Lorem.question }
let(:text_answer) { Faker::Lorem.sentence }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
15 changes: 2 additions & 13 deletions spec/features/fill_in_and_submit_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,8 @@
let(:answer_text) { "Answer text" }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end

let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
7 changes: 1 addition & 6 deletions spec/features/fill_in_and_submit_form_with_csv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@
end
let(:form) { build :v2_form_document, :live?, id: 1, name: "Fill in this form", steps:, start_page: steps.first.id, submission_type: "email_with_csv" }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }
let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
15 changes: 2 additions & 13 deletions spec/features/fill_in_autocomplete_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,8 @@
let(:answer_text) { "Answer 1" }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end

let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
15 changes: 2 additions & 13 deletions spec/features/fill_in_file_upload_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@
let(:answer_text) { "Answer 1" }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end

let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

let(:test_file) { "tmp/a-file.txt" }
let(:test_file_content) { "some content" }
Expand Down
15 changes: 2 additions & 13 deletions spec/features/fill_in_form_with_exit_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,8 @@
let(:question_text) { Faker::Lorem.question }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end

let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
15 changes: 2 additions & 13 deletions spec/features/fill_in_single_repeatable_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,8 @@
let(:second_answer_text) { "7" }
let(:reference) { Faker::Alphanumeric.alphanumeric(number: 8).upcase }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end

let(:post_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Content-Type" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }
let(:post_headers) { { "Content-Type" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/errors_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@
)
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/add_another_answer_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
build :v2_question_page_step, :with_text_settings, id: 2
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/draft" }

Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/base_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@
]
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/live" }

Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/check_your_answers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@
]
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/live" }
let(:mode) { "form" }
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/page_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@

let(:is_optional) { false }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/live" }
let(:mode) { "form" }
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/privacy_page_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@
]
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

describe "#show" do
before do
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/remove_answer_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
build :v2_question_page_step, :with_text_settings, id: 2
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/draft" }

Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/remove_file_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@

let(:steps_data) { [file_upload_step, text_question_step] }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/live" }
let(:mode) { "form" }
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/review_file_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@

let(:steps_data) { [file_upload_step, text_question_step] }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:api_url_suffix) { "/live" }
let(:mode) { "form" }
Expand Down
7 changes: 1 addition & 6 deletions spec/requests/forms/submitted_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@
}
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

describe "#submitted" do
before do
Expand Down
7 changes: 1 addition & 6 deletions spec/resources/api/v2/form_document_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,7 @@
"routing_conditions" => [] }] }
end

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down
7 changes: 1 addition & 6 deletions spec/services/api/v1/form_snapshot_repository_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
require "rails_helper"

RSpec.describe Api::V1::FormSnapshotRepository do
let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

let(:form_id) { 1 }
let(:api_v2_response_data) do
Expand Down
7 changes: 1 addition & 6 deletions spec/services/form_submission_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@
let(:aws_ses_submission_service_spy) { instance_double(AwsSesSubmissionService) }
let(:mail_message_id) { "1234" }

let(:req_headers) do
{
"X-API-Token" => Settings.forms_api.auth_key,
"Accept" => "application/json",
}
end
let(:req_headers) { { "Accept" => "application/json" } }

before do
ActiveResource::HttpMock.respond_to do |mock|
Expand Down