Skip to content

Commit

Permalink
Fixes #36530 - Fixed up /katello/api/sync_plans/:sync_plan_id/product…
Browse files Browse the repository at this point in the history
…s and /katello/api/repositories/:repository_id/sync API endpoints. (#10632)

Fixed broken ktests
  • Loading branch information
qcjames53 authored Jul 3, 2023
1 parent f9bf7d0 commit a2959b2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/controllers/katello/api/v2/sync_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Api::V2::SyncController < Api::V2::ApiController
before_action :find_object, :only => [:index]
before_action :ensure_library, :only => [:index]

api :GET, "/organizations/:organization_id/products/:product_id/sync", N_("Get status of repo synchronisation for given product")
api :GET, "/repositories/:repository_id/sync", N_("Get status of synchronisation for given repository")
def index
respond_for_async(:resource => @obj.sync_status)
Expand Down
4 changes: 4 additions & 0 deletions app/models/katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,10 @@ def in_content_view?(content_view)
content_view.repositories.include? self
end

def sync_status
return latest_dynflow_sync
end

protected

def unit_type_for_removal(type_class = nil)
Expand Down
1 change: 0 additions & 1 deletion app/views/katello/api/v2/sync/index.json.rabl

This file was deleted.

1 change: 1 addition & 0 deletions config/routes/api/v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class ActionDispatch::Routing::Mapper
end

api_resources :sync_plans, :only => [:index, :show, :update, :destroy] do
api_resources :products, :only => [:index]
get :auto_complete_search, :on => :collection
put :sync
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/api/v2/sync_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setup
end

def test_index
Product.any_instance.expects(:sync_status).returns([{}])
Product.any_instance.expects(:sync_status).returns([])

get :index, params: { :product_id => @product.cp_id, :organization_id => @organization.id }
assert_response :success
Expand Down

0 comments on commit a2959b2

Please sign in to comment.