LG-9168: Set up public mock address search and usps location search endpoints#8869
LG-9168: Set up public mock address search and usps location search endpoints#8869allthesignals merged 15 commits intomainfrom
Conversation
sheldon-b
left a comment
There was a problem hiding this comment.
We should also add tests to ensure the new routes return 404 when the feature flag is disabled
| module Idv | ||
| module InPerson | ||
| module Public | ||
| class MockAddressSearchController < ApplicationController |
There was a problem hiding this comment.
My first thought was to add barebones versions of the actual controllers we want, eg AddressSearchController and UspsLocationsController, so that we can flesh them out over time
I'm fine with this approach too. Seems like a little more code turnover to later remove this 🤷
There was a problem hiding this comment.
I agree, I think the controllers should be generic and have the internal behavior change between real/mock results based on configuration.
There was a problem hiding this comment.
Okay, I can split this out into those two. I agree, I think that's better.
I need to use the respective mock classes because there is internal post-processing that needs to be captured.
| allow(IdentityConfig.store).to receive(:in_person_public_address_search_enabled). | ||
| and_return(false) |
There was a problem hiding this comment.
Struggling to get the test to work with this stub... it seems to recognize the routes when I change the default value of this config variable. However, it doesn't recognize routes when I try to stub over the default:
ActionController::UrlGenerationError:
No route matches {:action=>"index", :address=>"100 main", :controller=>"idv/in_person/public/address_search", :host=>"www.example.com"}
There was a problem hiding this comment.
I think you need to call Rails.application.reload_routes! before/after to reload the specs. We've had lots of issues with test pollution with this in the past, so I'd be careful
There was a problem hiding this comment.
Yeah, I think the preference is to use check_or_render_not_found to avoid that, ex:
There was a problem hiding this comment.
I see. I think we cannot test when the flag is off if we wrap the actual routes in routes.rb with a feature flag (looking here for precedent).
The ready_to_verify_controller maps to routes that are not hidden behind a feature flag in routes...
I'll change this around and see what you think.
spec/controllers/idv/in_person/public/address_search_controller_spec.rb
Outdated
Show resolved
Hide resolved
spec/controllers/idv/in_person/public/usps_locations_controller_spec.rb
Outdated
Show resolved
Hide resolved
…r_spec.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
…r_spec.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
## 🎫 Ticket
🛠 Summary of changes
Set up public-facing mock address and USPS location endpoints for use by identity-site PO search
📜 Testing Plan
Provide a checklist of steps to confirm the changes.