summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_owner_command.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-01 09:41:32 +0000
commit25a9b62d45ddd60a231272567c7dda9337da9b62 (patch)
treee72ba4c9c01cba5fb510eb1eafaba76d998baf4c /test/rubygems/test_gem_commands_owner_command.rb
parent86bb0af7ea3b50f72e6845a6f5f64cb1b23fd279 (diff)
Import rubygems 1.6.0 (released version @ 58d8a0b9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_owner_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb
index 38e49ea79d..a07c3095aa 100644
--- a/test/rubygems/test_gem_commands_owner_command.rb
+++ b/test/rubygems/test_gem_commands_owner_command.rb
@@ -53,6 +53,20 @@ EOF
assert_match response, @ui.output
end
+ def test_show_owners_key
+ response = "- email: user1@example.com\n"
+ @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+ File.open Gem.configuration.credentials_path, 'a' do |f|
+ f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ end
+ Gem.configuration.load_api_keys
+
+ @cmd.handle_options %w(-k other)
+ @cmd.show_owners('freewill')
+
+ assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
+ end
+
def test_add_owners
response = "Owner added successfully."
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
@@ -81,6 +95,20 @@ EOF
assert_match response, @ui.output
end
+ def test_add_owners_key
+ response = "Owner added successfully."
+ @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
+ File.open Gem.configuration.credentials_path, 'a' do |f|
+ f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ end
+ Gem.configuration.load_api_keys
+
+ @cmd.handle_options %w(-k other)
+ @cmd.add_owners('freewill', ['user-new1@example.com'])
+
+ assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
+ end
+
def test_remove_owners
response = "Owner removed successfully."
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
@@ -108,4 +136,18 @@ EOF
assert_match response, @ui.output
end
+
+ def test_remove_owners_key
+ response = "Owner removed successfully."
+ @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK']
+ File.open Gem.configuration.credentials_path, 'a' do |f|
+ f.write ':other: 701229f217cdf23b1344c7b4b54ca97'
+ end
+ Gem.configuration.load_api_keys
+
+ @cmd.handle_options %w(-k other)
+ @cmd.remove_owners('freewill', ['user-remove1@example.com'])
+
+ assert_equal '701229f217cdf23b1344c7b4b54ca97', @fetcher.last_request['Authorization']
+ end
end