summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authorAshley Ellis Pierce <anellis12@gmail.com>2023-03-29 13:20:47 -0400
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-04-12 12:00:25 +0900
commit851344965ab9917af6caab39ac065e0f0d70b489 (patch)
treed97f30419129b27ae7c06f7826e9ad392bbb5fca /test/rubygems
parent1b1485ae4dd25fd4a8f2ee20608b11f5b2a486f8 (diff)
downloadruby-851344965ab9917af6caab39ac065e0f0d70b489.tar.gz
Ensure api_key is sent if basic auth not provided on webauthn_verification_url
Co-authored-by: Jenny Shen <jenny.shen@shopify.com>
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb2
3 files changed, 5 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 18f9a2ecdf..091335ab4b 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -417,6 +417,8 @@ EOF
end
url_with_port = "#{webauthn_verification_url}?port=#{port}"
+
+ assert_match @stub_fetcher.last_request["Authorization"], Gem.configuration.rubygems_api_key
assert_match "You have enabled multi-factor authentication. Please visit #{url_with_port} to authenticate via security device. If you can't verify using WebAuthn but have OTP enabled, you can re-run the gem signin command with the `--otp [your_code]` option.", @stub_ui.output
assert_match "ERROR: Security device verification failed: Something went wrong", @stub_ui.error
refute_match "You are verified with a security device. You may close the browser window.", @stub_ui.output
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index c8de71823d..aa0cf87474 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -482,6 +482,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
end
assert_equal 1, error.exit_code
+ assert_match @fetcher.last_request["Authorization"], Gem.configuration.rubygems_api_key
url_with_port = "#{webauthn_verification_url}?port=#{port}"
assert_match "You have enabled multi-factor authentication. Please visit #{url_with_port} to authenticate via security device. If you can't verify using WebAuthn but have OTP enabled, you can re-run the gem signin command with the `--otp [your_code]` option.", @ui.output
assert_match "ERROR: Security device verification failed: Something went wrong", @ui.error
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
index f50599f8e5..e5e234e0f8 100644
--- a/test/rubygems/test_gem_commands_yank_command.rb
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -185,6 +185,8 @@ class TestGemCommandsYankCommand < Gem::TestCase
assert_equal 1, error.exit_code
url_with_port = "#{webauthn_verification_url}?port=#{port}"
+
+ assert_match @fetcher.last_request["Authorization"], Gem.configuration.rubygems_api_key
assert_match %r{Yanking gem from http://example}, @ui.output
assert_match "You have enabled multi-factor authentication. Please visit #{url_with_port} to authenticate via security device. If you can't verify using WebAuthn but have OTP enabled, you can re-run the gem signin command with the `--otp [your_code]` option.", @ui.output
assert_match "ERROR: Security device verification failed: Something went wrong", @ui.error