Skip to content

Commit

Permalink
[api] become compatible again to obs <= 2.3 for project searches whic…
Browse files Browse the repository at this point in the history
…h osc used so far. Unbreaking maintenance requests (bnc#769948)
  • Loading branch information
adrianschroeter committed Nov 6, 2012
1 parent d8f9079 commit 546ae4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/api/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
match 'search/published/pattern/id' => :pass_to_backend
match 'search/project/id' => :project_id
match 'search/package/id' => :package_id
match 'search/project_id' => :project_id #FIXME3.0: to be removed
match 'search/package_id' => :package_id #FIXME3.0: to be removed
match 'search/project' => :project
match 'search/package' => :package
match 'search/attribute' => :attribute
Expand Down
20 changes: 19 additions & 1 deletion src/api/test/functional/search_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def test_xpath_3
prepare_request_with_user "Iggy", "asdfasdf"
get "/search/package", :match => '[attribute/@name="OBS:Maintained" and @name="apache2"]'
assert_response :success
assert_xml_tag :tag => 'collection', :children => { :count => 1 }
assert_xml_tag :tag => 'collection', :attributes => { :matches => 1 }
assert_xml_tag :child => { :tag => 'package', :attributes => { :name => 'apache2', :project => "Apache"} }
get "/search/package/id", :match => '[attribute/@name="OBS:Maintained" and @name="apache2"]'
assert_response :success
assert_xml_tag :tag => 'collection', :attributes => { :matches => 1 }
assert_xml_tag :child => { :tag => 'package', :attributes => { :name => 'apache2', :project => "Apache"} }
end

Expand All @@ -73,6 +77,20 @@ def test_xpath_6
assert_select "status[code] > summary", /illegal xpath attribute/
end

def test_xpath_old_osc
# old osc < 0.137 did use the search interface wrong, but that worked ... :/
# FIXME3.0: to be removed!
prepare_request_with_user "Iggy", "asdfasdf"
get "/search/package_id", :match => '[attribute/@name="OBS:Maintained" and @name="apache2"]'
assert_response :success
assert_xml_tag :tag => 'collection', :attributes => { :matches => 1 }
assert_xml_tag :child => { :tag => 'package', :attributes => { :name => 'apache2', :project => "Apache"} }
get "/search/project_id", :match => '[@name="kde"]'
assert_response :success
assert_xml_tag :tag => 'collection', :attributes => { :matches => 1 }
assert_xml_tag :child => { :tag => 'project', :attributes => { :name => 'kde' } }
end

# >>> Testing HiddenProject - flag "access" set to "disabled"
def test_search_hidden_project_with_valid_user
# user is maintainer, thus access to hidden project is allowed
Expand Down

0 comments on commit 546ae4a

Please sign in to comment.