Skip to content

Commit

Permalink
[api] increase coverage - by removing more rbac and adding architectures
Browse files Browse the repository at this point in the history
test
  • Loading branch information
coolo committed Apr 10, 2012
1 parent ed91594 commit c882bc9
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 615 deletions.
2 changes: 1 addition & 1 deletion src/api/app/controllers/about_controller.rb
Expand Up @@ -3,7 +3,7 @@ class AboutController < ApplicationController
validate_action :index => {:method => :get, :response => :about}

def index
@api_revision = "#{CONFIG['version']}"
@api_revision = CONFIG['version'].to_s
end

end
10 changes: 0 additions & 10 deletions src/api/app/controllers/active_rbac/component_controller.rb

This file was deleted.

133 changes: 0 additions & 133 deletions src/api/app/controllers/active_rbac/group_controller.rb

This file was deleted.

128 changes: 0 additions & 128 deletions src/api/app/controllers/active_rbac/login_controller.rb

This file was deleted.

42 changes: 0 additions & 42 deletions src/api/app/controllers/active_rbac/my_account_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions src/api/app/controllers/application_controller.rb
Expand Up @@ -29,9 +29,6 @@ class ApplicationController < ActionController::Base
@user_permissions = nil
@http_user = nil

helper RbacHelper


before_filter :validate_xml_request, :add_api_version
if defined?( RESPONSE_SCHEMA_VALIDATION ) && RESPONSE_SCHEMA_VALIDATION == true
after_filter :validate_xml_response
Expand Down Expand Up @@ -443,9 +440,6 @@ def log_error(exception)
end

def rescue_with_handler(exception)
logger.debug("\n#{exception.class} (#{exception.message}):\n " +
exception.backtrace.join("\n ") + "\n\n")

case exception
when Suse::Backend::NotFoundError
render_error :message => exception.message, :status => 404
Expand Down
16 changes: 4 additions & 12 deletions src/api/app/controllers/architectures_controller.rb
Expand Up @@ -39,9 +39,7 @@ def index
# GET /architecture/i386
# GET /architecture/i386.xml
def show
unless params[:id]
render_error :status => 400, :errorcode => "missing_parameter'", :message => "Missing parameter 'name'" and return
end
required_parameters :id
@architecture = Architecture.find_by_name(params[:id])
unless @architecture
render_error :status => 400, :errorcode => "unknown_architecture", :message => "Architecture does not exist: #{params[:id]}" and return
Expand All @@ -61,9 +59,7 @@ def show

# POST /architecture/i386
def create
unless params[:id]
render_error :status => 400, :errorcode => "missing_parameter'", :message => "Missing parameter 'name'" and return
end
required_parameters :id

xml = REXML::Document.new(request.raw_post)
@architecture = Architecture.new(
Expand All @@ -83,9 +79,7 @@ def create

# PUT /architecture/i385
def update
unless params[:id]
render_error :status => 400, :errorcode => "missing_parameter'", :message => "Missing parameter 'name'" and return
end
required_parameters :id
@architecture = Architecture.find_by_name(params[:id])
unless @architecture
render_error :status => 400, :errorcode => "unknown_architecture", :message => "Architecture does not exist: #{params[:id]}" and return
Expand All @@ -104,9 +98,7 @@ def update

# DELETE /architecture/i386
def delete
unless params[:id]
render_error :status => 400, :errorcode => "missing_parameter'", :message => "Missing parameter 'name'" and return
end
required_parameters :id
@architecture = Architecture.find_by_name(params[:id])
@architecture.destroy

Expand Down

0 comments on commit c882bc9

Please sign in to comment.