Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDM-346/enable gids flight school mocks #19649

Merged
merged 6 commits into from
Nov 29, 2024
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
7 changes: 7 additions & 0 deletions config/betamocks/services_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,13 @@
- :name: "GIDS"
:base_uri: <%= "#{URI(Settings.gids.url).host}:#{URI(Settings.gids.url).port}" %>
:endpoints:
- :method: :get
:path: "/gids/v0/institution_programs"
:file_path: "gids/programs"
# Mock only enabled when filtering by flight programs, see: lib/gi/search_client.rb
:cache_multiple_responses:
:uid_location: query
:uid_locator: type
- :method: :get
:path: "/gids/v1/lce"
:file_path: "gids/lce"
Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@ gids:
url: https://dev.va.gov/gids
open_timeout: 1
read_timeout: 1
search:
use_mocks: false
lce:
use_mocks: false

Expand Down
4 changes: 4 additions & 0 deletions lib/gi/search_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def get_institution_search_results_v0(params = {})
end

def get_institution_program_search_results_v0(params = {})
# Mock response if querying for flight school programs
# TO-DO: Remove after flight school program data becomes accessible
config.instance_variable_set(:@program_type_flight, true) if params[:type] == 'FLGT'

response = perform(:get, 'v0/institution_programs', params)
gids_response(response)
end
Expand Down
9 changes: 9 additions & 0 deletions lib/gi/search_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@ module GI
class SearchConfiguration < GI::Configuration
self.read_timeout = Settings.gids.search&.read_timeout || 4
self.open_timeout = Settings.gids.search&.open_timeout || 4

# Mock response if querying for flight school programs
# TO-DO: Remove after flight school program data becomes accessible
def use_mocks?
return false unless instance_variable_defined?(:@program_type_flight)

querying_by_flight = remove_instance_variable(:@program_type_flight)
(querying_by_flight && Settings.gids.search.use_mocks) || false
end
end
end
Loading