From 25a9b62d45ddd60a231272567c7dda9337da9b62 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 1 Mar 2011 09:41:32 +0000 Subject: 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 --- test/rubygems/test_gem_commands_owner_command.rb | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/rubygems/test_gem_commands_owner_command.rb') 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 -- cgit v1.2.3