Commit c2eb23e1 authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Bob Van Landuyt

Resolve "API Dependency List - usage ping"

parent 1ec12b73
...@@ -35,6 +35,8 @@ module API ...@@ -35,6 +35,8 @@ module API
get ':id/dependencies' do get ':id/dependencies' do
authorize! :read_dependencies, user_project authorize! :read_dependencies, user_project
track_event('view_dependencies')
dependencies = dependencies_by(declared_params.merge(project: user_project)) dependencies = dependencies_by(declared_params.merge(project: user_project))
present dependencies, with: ::EE::API::Entities::Dependency, user: current_user, project: user_project present dependencies, with: ::EE::API::Entities::Dependency, user: current_user, project: user_project
......
...@@ -7,13 +7,16 @@ describe API::Dependencies do ...@@ -7,13 +7,16 @@ describe API::Dependencies do
set(:user) { create(:user) } set(:user) { create(:user) }
describe "GET /projects/:id/dependencies" do describe "GET /projects/:id/dependencies" do
let(:request) { get api("/projects/#{project.id}/dependencies", user), params: params } subject(:request) { get api("/projects/#{project.id}/dependencies", user), params: params }
let(:params) { {} } let(:params) { {} }
before do before do
stub_licensed_features(dependency_scanning: true, security_dashboard: true) stub_licensed_features(dependency_scanning: true, security_dashboard: true)
end end
it_behaves_like 'a gitlab tracking event', described_class.name, 'view_dependencies'
context 'with an authorized user with proper permissions' do context 'with an authorized user with proper permissions' do
before do before do
create(:ee_ci_pipeline, :with_dependency_list_report, project: project) create(:ee_ci_pipeline, :with_dependency_list_report, project: project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment