Skip to content

Commit

Permalink
Add snac in local_links_manager stub response for local_authority
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinailie committed Aug 3, 2022
1 parent 809c007 commit c7dc071
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/gds_api/test_helpers/local_links_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def convert_to_query_string_params(parameters)
parameters
end

def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", local_custodian_code: nil)
def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
response = {
"local_authorities" => [
{
Expand All @@ -107,6 +107,7 @@ def stub_local_links_manager_has_a_local_authority(authority_slug, country_name:
"country_name" => country_name,
"tier" => "unitary",
"slug" => authority_slug,
"snac" => snac,
},
],
}
Expand All @@ -122,7 +123,7 @@ def stub_local_links_manager_has_a_local_authority(authority_slug, country_name:
end
end

def stub_local_links_manager_has_a_district_and_county_local_authority(district_slug, county_slug, local_custodian_code: nil)
def stub_local_links_manager_has_a_district_and_county_local_authority(district_slug, county_slug, district_snac: "00AG", county_snac: "00LC", local_custodian_code: nil)
response = {
"local_authorities" => [
{
Expand All @@ -131,13 +132,15 @@ def stub_local_links_manager_has_a_district_and_county_local_authority(district_
"country_name" => "England",
"tier" => "district",
"slug" => district_slug,
"snac" => district_snac,
},
{
"name" => county_slug.capitalize,
"homepage_url" => "http://#{county_slug}.example.com",
"country_name" => "England",
"tier" => "county",
"slug" => county_slug,
"snac" => county_snac,
},
],
}
Expand Down Expand Up @@ -177,7 +180,7 @@ def stub_local_links_manager_does_not_have_a_custodian_code(local_custodian_code
.to_return(body: {}.to_json, status: 404)
end

def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", local_custodian_code: nil)
def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
response = {
"local_authorities" => [
{
Expand All @@ -186,6 +189,7 @@ def stub_local_links_manager_has_a_local_authority_without_homepage(authority_sl
"country_name" => country_name,
"tier" => "unitary",
"slug" => authority_slug,
"snac" => snac,
},
],
}
Expand Down
8 changes: 7 additions & 1 deletion test/local_links_manager_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
describe "#local_authority" do
describe "when making a request for a local authority with a parent" do
it "should return the local authority and its parent" do
stub_local_links_manager_has_a_district_and_county_local_authority("blackburn", "rochester")
stub_local_links_manager_has_a_district_and_county_local_authority("blackburn", "rochester", district_snac: "test1", county_snac: "test2")

expected_response = {
"local_authorities" => [
Expand All @@ -293,13 +293,15 @@
"country_name" => "England",
"tier" => "district",
"slug" => "blackburn",
"snac" => "test1",
},
{
"name" => "Rochester",
"homepage_url" => "http://rochester.example.com",
"country_name" => "England",
"tier" => "county",
"slug" => "rochester",
"snac" => "test2",
},
],
}
Expand All @@ -321,6 +323,7 @@
"country_name" => "England",
"tier" => "unitary",
"slug" => "blackburn",
"snac" => "00AG",
},
],
}
Expand Down Expand Up @@ -362,13 +365,15 @@
"country_name" => "England",
"tier" => "district",
"slug" => "blackburn",
"snac" => "00AG",
},
{
"name" => "Rochester",
"homepage_url" => "http://rochester.example.com",
"country_name" => "England",
"tier" => "county",
"slug" => "rochester",
"snac" => "00LC",
},
],
}
Expand All @@ -390,6 +395,7 @@
"country_name" => "England",
"tier" => "unitary",
"slug" => "blackburn",
"snac" => "00AG",
},
],
}
Expand Down

0 comments on commit c7dc071

Please sign in to comment.