-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate required API credentials are there otherwise show error message
This prevents a nil value to propagate down to the HTTP client and then emerge in the error page as an exception.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require File.expand_path('../../test_helper', __FILE__) | ||
|
||
class ValidateConfigurationTest < ActionDispatch::IntegrationTest | ||
def test_validate_configuration | ||
# Fake that authentication is not configured | ||
x = Rails.configuration.x.clone | ||
Rails.configuration.x.api_username = nil | ||
Rails.configuration.x.opensuse_cookie = nil | ||
|
||
visit '/' | ||
page.assert_text 'The authentication to the OBS API has not been configured correctly.' | ||
assert_equal 503, page.status_code | ||
|
||
# Restore normal configuration values for other tests | ||
Rails.configuration.x = x | ||
end | ||
end |