Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #585 from liggitt/bug_1090912_handle_global_team_d…
Browse files Browse the repository at this point in the history
…elete_error

Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Apr 24, 2014
2 parents b3d700c + 67193c3 commit 1cbef33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rhc/rest/mock.rb
Expand Up @@ -698,6 +698,7 @@ def initialize(client, name, id="123")
end

def destroy
raise RHC::OperationNotSupportedException.new("The server does not support deleting this resource.") unless supports? 'DELETE'
client.teams.delete_if { |t| t.name == @name }
end

Expand Down
1 change: 1 addition & 0 deletions lib/rhc/rest/team.rb
Expand Up @@ -20,6 +20,7 @@ def to_s

def destroy(force=false)
debug "Deleting team #{name} (#{id})"
raise RHC::OperationNotSupportedException.new("The server does not support deleting this resource.") unless supports? 'DELETE'
rest_method "DELETE"
end
alias :delete :destroy
Expand Down
14 changes: 14 additions & 0 deletions spec/rhc/commands/team_spec.rb
Expand Up @@ -162,6 +162,20 @@
it { run_output.should match("Team with name deleteme not found") }
end

context 'when the server does not allow deleting' do
before do
t = rest_client.add_team("dontdelete")
t.links.delete 'DELETE'
t.id = "123"
end
let(:arguments) { ['team','delete','--team-id','123'] }
it "should error out" do
expect { run }.to exit_with_code(1)
rest_client.teams[0].name.should == 'dontdelete'
end
it { run_output.should match(/not support/) }
end

end

describe 'help' do
Expand Down

0 comments on commit 1cbef33

Please sign in to comment.