From 2656f1484aeb5d2f00b322c705bd76f81b09035e Mon Sep 17 00:00:00 2001 From: Eric Saupe Date: Tue, 18 Oct 2022 09:30:53 -0700 Subject: [PATCH] Remove unused index endpoints fixes LS-3541 flag=course_paces_redesign test plan: - tests pass Change-Id: Ifdfdc1b833e457e049e9e852f4e5b7e1f5b5734d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303490 Tested-by: Service Cloud Jenkins Reviewed-by: Robin Kuss QA-Review: Robin Kuss Product-Review: Eric Saupe --- .../course_pacing/paces_api_controller.rb | 8 ---- config/routes.rb | 2 - spec/requests/section_paces_spec.rb | 40 ------------------- .../requests/student_enrollment_paces_spec.rb | 36 ----------------- 4 files changed, 86 deletions(-) diff --git a/app/controllers/course_pacing/paces_api_controller.rb b/app/controllers/course_pacing/paces_api_controller.rb index a6a3c8f3043..03e2521964c 100644 --- a/app/controllers/course_pacing/paces_api_controller.rb +++ b/app/controllers/course_pacing/paces_api_controller.rb @@ -24,14 +24,6 @@ class CoursePacing::PacesApiController < ApplicationController include Api::V1::Progress - def index - render json: { - paces: pacing_service.paces_in_course(course).map do |p| - pacing_presenter.new(p).as_json - end - } - end - def show pace = pacing_service.pace_for(context, should_duplicate: true) render json: { diff --git a/config/routes.rb b/config/routes.rb index 700ff8013d5..a71ec550d1f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2443,7 +2443,6 @@ CanvasRails::Application.routes.draw do end scope(controller: "course_pacing/section_paces_api") do - get "courses/:course_id/section_paces", action: :index, as: :section_paces get "courses/:course_id/sections/:course_section_id/pace", action: :show, as: :section_pace post "courses/:course_id/sections/:course_section_id/paces", action: :create, as: :new_section_pace patch "courses/:course_id/sections/:course_section_id/pace", action: :update, as: :patch_section_pace @@ -2451,7 +2450,6 @@ CanvasRails::Application.routes.draw do end scope(controller: "course_pacing/student_enrollment_paces_api") do - get "courses/:course_id/student_enrollment_paces", action: :index, as: :student_enrollment_paces get "courses/:course_id/student_enrollments/:student_enrollment_id/pace", action: :show, as: :student_enrollment_pace post "courses/:course_id/student_enrollments/:student_enrollment_id/paces", action: :create, as: :new_student_enrollment_pace patch "courses/:course_id/student_enrollments/:student_enrollment_id/pace", action: :update, as: :patch_student_enrollment_pace diff --git a/spec/requests/section_paces_spec.rb b/spec/requests/section_paces_spec.rb index c6d96fc90ec..bfd99e141b3 100644 --- a/spec/requests/section_paces_spec.rb +++ b/spec/requests/section_paces_spec.rb @@ -42,32 +42,6 @@ describe "Section Paces API" do expect(response.status).to eq 401 end - describe "index" do - let!(:section_pace) { section_pace_model(section: section) } - let!(:section_pace_with_enrollments) { section_pace_model(section: section_two) } - - before do - course_pace_model(course: course) - section_pace_model(section: section_three, workflow_state: "deleted") - end - - it "returns relevant paces" do - get api_v1_section_paces_path(course.id), params: { format: :json } - expect(response.status).to eq 200 - json = JSON.parse(response.body) - expect( - json["paces"].map { |p| p["id"] } - ).to match_array( - [section_pace.id, section_pace_with_enrollments.id] - ) - [section_pace, section_pace_with_enrollments].each do |pace| - pace_json = json["paces"].detect { |p| p["id"] == pace.id } - expect(pace_json["section"]["name"]).to eq pace.course_section.name - expect(pace_json["section"]["size"]).to eq pace.course_section.enrollments.count - end - end - end - describe "show" do it "returns the pace for the requested section" do section_pace = section_pace_model(section: section) @@ -221,20 +195,6 @@ describe "Section Paces API" do Account.site_admin.disable_feature!(:course_paces_redesign) end - describe "index" do - before do - section_pace_model(section: section) - section_pace_model(section: section_two) - course_pace_model(course: course) - section_pace_model(section: section_three, workflow_state: "deleted") - end - - it "returns 404" do - get api_v1_section_paces_path(course.id), params: { format: :json } - expect(response.status).to eq 404 - end - end - describe "show" do let(:section_pace) { section_pace_model(section: section) } let(:course_pace) { course_pace_model(course: course) } diff --git a/spec/requests/student_enrollment_paces_spec.rb b/spec/requests/student_enrollment_paces_spec.rb index 52dc302c8c5..829a802b0dc 100644 --- a/spec/requests/student_enrollment_paces_spec.rb +++ b/spec/requests/student_enrollment_paces_spec.rb @@ -38,31 +38,6 @@ describe "Student Enrollment Paces API" do expect(response.status).to eq 401 end - describe "index" do - let!(:student_pace) { student_enrollment_pace_model(student_enrollment: student_enrollment) } - - before do - course_pace_model(course: course) - end - - it "returns relevant paces" do - get api_v1_student_enrollment_paces_path(course.id), params: { format: :json } - expect(response.status).to eq 200 - json = JSON.parse(response.body) - expect( - json["paces"].map { |p| p["id"] } - ).to match_array( - [student_pace.id] - ) - pace_json = json["paces"].first - expect(pace_json["student"]["name"]).to eq student.name - end - - it "returns a 401 if the user lacks permissions" do - assert_grant_check { get api_v1_student_enrollment_paces_path(course.id), params: { format: :json } } - end - end - describe "show" do it "returns the pace for the requested student enrollment" do student_pace = student_enrollment_pace_model(student_enrollment: student_enrollment) @@ -241,17 +216,6 @@ describe "Student Enrollment Paces API" do Account.site_admin.disable_feature!(:course_paces_redesign) end - describe "index" do - before do - student_enrollment_pace_model(student_enrollment: student_enrollment) - end - - it "returns 404" do - get api_v1_student_enrollment_paces_path(course), params: { format: :json } - expect(response.status).to eq 404 - end - end - describe "show" do before do student_enrollment_pace_model(student_enrollment: student_enrollment)