Skip to content

Commit

Permalink
[api] route reorderiwi command
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Oct 10, 2016
1 parent 8751e3c commit 0eb9d26
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/api/api/api.txt
Expand Up @@ -247,6 +247,7 @@ POST /source

Commands on processing sources globally. Possible commands are
branch: branch a set of packages based on attributes or on existing request
orderkiwirepos: sort the repositories inside of a kiwi file according to path relationships
createmaintenanceincident: create mainatenance incident projects based on attribute search

Parameters:
Expand Down
7 changes: 6 additions & 1 deletion src/api/app/controllers/source_controller.rb
Expand Up @@ -48,7 +48,7 @@ def index

# POST /source
def global_command
unless %w(createmaintenanceincident branch).include? params[:cmd]
unless %w(createmaintenanceincident branch orderkiwirepos).include? params[:cmd]

This comment has been minimized.

Copy link
@ChrisBr

ChrisBr Oct 11, 2016

Member

I thought that we agreed that we will implement it in our sprint? @adrianschroeter

raise UnknownCommandError.new "Unknown command '#{params[:cmd]}' for path #{request.path}"
end
dispatch_command(:global_command, params[:cmd])
Expand Down Expand Up @@ -893,6 +893,11 @@ def global_command_branch
private_branch_command
end

# POST /source?cmd=orderkiwirepos
def global_command_orderkiwirepos
pass_to_backend
end

# create a id collection of all projects doing a project link to this one
# POST /source/<project>?cmd=showlinked
def project_command_showlinked
Expand Down
11 changes: 11 additions & 0 deletions src/api/test/functional/source_controller_test.rb
Expand Up @@ -60,6 +60,17 @@ def test_get_packagelist
:children => { :count => 2, :only => { :tag => 'entry' } }
end

def test_post_orderkiwirepos
post '/source?cmd=orderkiwirepos'
assert_response 401

login_tom
post '/source?cmd=orderkiwirepos'
assert_response 400
assert_xml_tag tag: 'status', attributes: { code: "400", origin: "backend" }
# api handed it over to backend, enough tested here
end

def test_get_packagelist_with_hidden_project
login_tom
get '/source/HiddenProject'
Expand Down

2 comments on commit 0eb9d26

@bgeuken
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianschroeter Backend or service errors would be handled by the existing code, right? So users would be able to see error messages from the service?

@mdeniz
Copy link
Contributor

@mdeniz mdeniz commented on 0eb9d26 Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.