Skip to content

Commit

Permalink
[api] find right container for unset owners.
Browse files Browse the repository at this point in the history
If a package has no owner yet, osc is doing a container search with explicit undefined filter.
This has to find the package and not the project container for a binary.
  • Loading branch information
adrianschroeter committed Oct 22, 2013
1 parent f6ba25e commit 07891b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/api/app/helpers/maintainership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def extract_maintainer(rootproject, pkg, rolefilter, objfilter=nil)
m[:package] = pkg.name
m[:filter] = rolefilter

# no filter defined, so do not check for roles and just return container
return m if rolefilter.length == 0

# construct where condition
sql = nil
if rolefilter.length > 0
Expand Down
5 changes: 5 additions & 0 deletions src/api/test/fixtures/relationships.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Iggy_maintainer_TestPack:
package_id: 10095
role_id: 3
user_id: 267
Iggy_bugowner_BaseDistro3:
id: 22
project_id: 2047
role_id: 4
user_id: 267
QA_Team:
id: 71
package_id: 10099
Expand Down
16 changes: 16 additions & 0 deletions src/api/test/functional/search_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,22 @@ def test_find_owner
assert_response :success
end

def test_search_for_binary_without_definition_yet
login_Iggy

get "/search/owner?project=BaseDistro3&filter=bugowner&binary=package&limit=1"
assert_response :success
# found project container
assert_xml_tag tag: 'owner', :attributes => { :rootproject => "BaseDistro3", :project => "BaseDistro3" }
assert_no_xml_tag tag: 'owner', :attributes => { :package => "pack2" }

# search with empty filter just to find the container to be set
get "/search/owner?project=BaseDistro3&filter=&binary=package&limit=1"
assert_response :success
# found package container
assert_xml_tag tag: 'owner', :attributes => { :rootproject => "BaseDistro3", :project => "BaseDistro3", :package => "pack2" }
end

def test_search_for_missing_role_defintions_in_all_visible_packages
login_Iggy

Expand Down
4 changes: 2 additions & 2 deletions src/api/test/unit/code_quality_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def setup
'IssueTracker#update_issues' => 60.49,
'IssueTrackersController#create' => 53.05,
'IssueTrackersController#update' => 100.78,
'Maintainership#extract_maintainer' => 144.49,
'Maintainership#extract_maintainer' => 146.8,
'Maintainership#find_assignees' => 64.17,
'MaintenanceHelper#create_new_maintenance_incident' => 64.93,
'MaintenanceHelper#do_branch' => 1118,
Expand All @@ -106,7 +106,7 @@ def setup
'PersonController#userinfo' => 139.67,
'Project#branch_to_repositories_from' => 117.4,
'Project#cleanup_before_destroy' => 67.17,
'Project#update_from_xml' => 456.54,
'Project#update_from_xml' => 448.36,
'Project::check_access?' => 54.05,
'Project::get_by_name' => 53.44,
'ProjectStatusCalculator#calc_status' => 74.59,
Expand Down

0 comments on commit 07891b2

Please sign in to comment.