canvas_sync 0.26.1 → 0.27.1.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +117 -20
- data/app/controllers/canvas_sync/api/v1/live_events_controller.rb +1 -0
- data/lib/canvas_sync/config.rb +1 -1
- data/lib/canvas_sync/importers/bulk_importer.rb +2 -0
- data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +1 -1
- data/lib/canvas_sync/jobs/beta_cleanup/create_temp_tables_job.rb +30 -0
- data/lib/canvas_sync/jobs/beta_cleanup/delete_related_records_job.rb +125 -0
- data/lib/canvas_sync/jobs/beta_cleanup/delete_temp_tables_job.rb +16 -0
- data/lib/canvas_sync/jobs/report_starter.rb +33 -46
- data/lib/canvas_sync/jobs/report_sync_task.rb +273 -0
- data/lib/canvas_sync/jobs/sync_accounts_job.rb +10 -7
- data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -15
- data/lib/canvas_sync/jobs/sync_assignment_overrides_job.rb +26 -14
- data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -15
- data/lib/canvas_sync/jobs/sync_content_migrations_job.rb +2 -15
- data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -15
- data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -15
- data/lib/canvas_sync/jobs/sync_course_progresses_job.rb +2 -16
- data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +135 -14
- data/lib/canvas_sync/jobs/sync_rubric_assessments_job.rb +2 -10
- data/lib/canvas_sync/jobs/sync_rubric_associations_job.rb +2 -10
- data/lib/canvas_sync/jobs/sync_rubrics_job.rb +2 -10
- data/lib/canvas_sync/jobs/sync_scores_job.rb +2 -13
- data/lib/canvas_sync/jobs/sync_submissions_job.rb +9 -18
- data/lib/canvas_sync/jobs/term_batches_job.rb +4 -2
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +31 -4
- data/spec/canvas_sync/canvas_sync_spec.rb +62 -22
- data/spec/canvas_sync/jobs/report_starter_spec.rb +102 -55
- data/spec/canvas_sync/jobs/report_sync_task_spec.rb +367 -0
- data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +24 -35
- data/spec/canvas_sync/processors/assignment_groups_processor_spec.rb +3 -4
- data/spec/canvas_sync/processors/assignment_overrides_processor_spec.rb +7 -4
- data/spec/canvas_sync/processors/assignments_processor_spec.rb +3 -4
- data/spec/canvas_sync/processors/content_migrations_processor_spec.rb +3 -4
- data/spec/canvas_sync/processors/context_module_items_processor_spec.rb +4 -5
- data/spec/canvas_sync/processors/context_modules_processor_spec.rb +3 -4
- data/spec/canvas_sync/processors/course_completion_report_processor_spec.rb +7 -4
- data/spec/canvas_sync/processors/provisioning_report_processor_spec.rb +46 -24
- data/spec/canvas_sync/processors/rubric_assessments_spec.rb +3 -4
- data/spec/canvas_sync/processors/rubric_associations_spec.rb +3 -4
- data/spec/canvas_sync/processors/rubrics_processor_spec.rb +3 -4
- data/spec/canvas_sync/processors/submissions_processor_spec.rb +3 -4
- data/spec/factories/account_factory.rb +1 -1
- metadata +7 -33
- data/lib/canvas_sync/jobs/report_checker.rb +0 -108
- data/lib/canvas_sync/jobs/report_processor_job.rb +0 -35
- data/lib/canvas_sync/processors/assignment_groups_processor.rb +0 -19
- data/lib/canvas_sync/processors/assignment_overrides_processor.rb +0 -41
- data/lib/canvas_sync/processors/assignments_processor.rb +0 -19
- data/lib/canvas_sync/processors/content_migrations_processor.rb +0 -19
- data/lib/canvas_sync/processors/context_module_items_processor.rb +0 -19
- data/lib/canvas_sync/processors/context_modules_processor.rb +0 -19
- data/lib/canvas_sync/processors/course_completion_report_processor.rb +0 -20
- data/lib/canvas_sync/processors/provisioning_report_processor.rb +0 -149
- data/lib/canvas_sync/processors/rubric_assessments_processor.rb +0 -19
- data/lib/canvas_sync/processors/rubric_associations_processor.rb +0 -19
- data/lib/canvas_sync/processors/rubrics_processor.rb +0 -19
- data/lib/canvas_sync/processors/submissions_processor.rb +0 -19
- data/spec/canvas_sync/jobs/report_checker_spec.rb +0 -57
- data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -25
- data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +0 -18
- data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +0 -30
- data/spec/canvas_sync/jobs/sync_content_migrations_job_spec.rb +0 -30
- data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +0 -30
- data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +0 -30
- data/spec/canvas_sync/jobs/sync_scores_job_spec.rb +0 -15
- data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +0 -23
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require_relative "./report_processor"
|
|
2
|
-
|
|
3
|
-
module CanvasSync
|
|
4
|
-
module Processors
|
|
5
|
-
# Processes a course completion report using the bulk importer.
|
|
6
|
-
#
|
|
7
|
-
# @param report_file_path [String]
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
class CourseCompletionReportProcessor < ReportProcessor
|
|
10
|
-
def self.process(report_file_path, _options, report_id)
|
|
11
|
-
new(report_file_path, _options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def initialize(report_file_path, options)
|
|
15
|
-
do_bulk_import(report_file_path, CourseProgress, options: options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
require "csv"
|
|
2
|
-
require "activerecord-import"
|
|
3
|
-
require "zip"
|
|
4
|
-
require "zip/version"
|
|
5
|
-
require_relative "./report_processor"
|
|
6
|
-
|
|
7
|
-
module CanvasSync
|
|
8
|
-
module Processors
|
|
9
|
-
class ProvisioningReportProcessor < ReportProcessor
|
|
10
|
-
# Processes a provisioning report using the bulk importer.
|
|
11
|
-
#
|
|
12
|
-
# options must contain a models key. If there is only one model
|
|
13
|
-
# Canvas downloads the single report directly as a CSV. If it's
|
|
14
|
-
# more than one model Canvas downloads a ZIP file, so we have to
|
|
15
|
-
# extract that and iterate through it for processing.
|
|
16
|
-
#
|
|
17
|
-
# @param report_file_path [String]
|
|
18
|
-
# @param options [Hash]
|
|
19
|
-
def self.process(report_file_path, options, report_id)
|
|
20
|
-
new(report_file_path, options)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def initialize(report_file_path, options) # rubocop:disable Metrics/AbcSize
|
|
24
|
-
@options = options
|
|
25
|
-
if options[:models].length == 1
|
|
26
|
-
run_import(options[:models][0], report_file_path)
|
|
27
|
-
else
|
|
28
|
-
unzipped_file_dir = extract(report_file_path)
|
|
29
|
-
Dir[unzipped_file_dir + "/*.csv"].sort.each do |file_path|
|
|
30
|
-
model_name = file_path.split("/").last.split(".").first
|
|
31
|
-
run_import(model_name, file_path)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def extract(file_path)
|
|
39
|
-
unzipped_file_dir = "#{file_path}_unzipped"
|
|
40
|
-
|
|
41
|
-
Zip::File.open(file_path) do |zip_file|
|
|
42
|
-
zip_file.each do |f|
|
|
43
|
-
f_path = File.join(unzipped_file_dir, f.name)
|
|
44
|
-
FileUtils.mkdir_p(File.dirname(f_path))
|
|
45
|
-
next if File.exist?(f_path)
|
|
46
|
-
|
|
47
|
-
if Zip::VERSION >= "3.0.0"
|
|
48
|
-
zip_file.extract(f, destination_directory: unzipped_file_dir)
|
|
49
|
-
else
|
|
50
|
-
zip_file.extract(f, f_path)
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
unzipped_file_dir
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def run_import(model_name, report_file_path)
|
|
59
|
-
if legacy?(model_name)
|
|
60
|
-
CanvasSync::Importers::LegacyImporter.import(
|
|
61
|
-
report_file_path,
|
|
62
|
-
model_name.singularize.capitalize.constantize,
|
|
63
|
-
@options[:account_id],
|
|
64
|
-
@options,
|
|
65
|
-
)
|
|
66
|
-
else
|
|
67
|
-
send("bulk_process_#{model_name}", report_file_path)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def legacy?(model_name)
|
|
72
|
-
opt = @options[:legacy_support]
|
|
73
|
-
return false if opt == false || opt.nil?
|
|
74
|
-
return true if opt == true
|
|
75
|
-
return opt.include?(model_name)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def bulk_process_users(report_file_path)
|
|
79
|
-
do_bulk_import(report_file_path, User, options: @options)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def bulk_process_user_observers(report_file_path)
|
|
83
|
-
do_bulk_import(report_file_path, UserObserver, options: @options)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def bulk_process_pseudonyms(report_file_path)
|
|
87
|
-
do_bulk_import(report_file_path, Pseudonym, options: @options)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def bulk_process_accounts(report_file_path)
|
|
91
|
-
do_bulk_import(report_file_path, Account, options: @options)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def bulk_process_courses(report_file_path)
|
|
95
|
-
do_bulk_import(report_file_path, Course, options: @options)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def bulk_process_enrollments(report_file_path)
|
|
99
|
-
do_bulk_import(report_file_path, Enrollment, options: @options)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def bulk_process_sections(report_file_path)
|
|
103
|
-
do_bulk_import(report_file_path, Section, options: @options)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def bulk_process_xlist(report_file_path)
|
|
107
|
-
do_bulk_import(report_file_path, Section, options: @options, mapping_key: :xlist)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def bulk_process_groups(report_file_path)
|
|
111
|
-
do_bulk_import(report_file_path, Group, options: @options)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def bulk_process_grading_periods(report_file_path)
|
|
115
|
-
do_bulk_import(report_file_path, GradingPeriod, options: @options)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def bulk_process_grading_period_groups(report_file_path)
|
|
119
|
-
do_bulk_import(report_file_path, GradingPeriodGroup, options: @options)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# Note that group membership is singular because we override the model name param in sync_provisioning_report_job
|
|
123
|
-
def bulk_process_group_membership(report_file_path)
|
|
124
|
-
do_bulk_import(report_file_path, GroupMembership, options: @options)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def bulk_process_learning_outcomes(report_file_path)
|
|
128
|
-
do_bulk_import(report_file_path, LearningOutcome, options: @options) do |row|
|
|
129
|
-
row[:root_account_ids] = JSON.parse row[:root_account_ids]
|
|
130
|
-
row
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def bulk_process_learning_outcome_results(report_file_path)
|
|
135
|
-
do_bulk_import(report_file_path, LearningOutcomeResult, options: @options)
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def bulk_process_course_nicknames(report_file_path)
|
|
139
|
-
exists = []
|
|
140
|
-
do_bulk_import(report_file_path, CourseNickname, options: @options) do |row|
|
|
141
|
-
exists << row[:user_preference_value_id]
|
|
142
|
-
row
|
|
143
|
-
end
|
|
144
|
-
# Canvas does not soft delete UserPreferenceValues so there's no point in doing the same
|
|
145
|
-
CourseNickname.where.not(canvas_user_preference_value_id: exists).or(CourseNickname.where(canvas_user_preference_value_id: nil)).delete_all
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require_relative "./report_processor"
|
|
2
|
-
|
|
3
|
-
module CanvasSync
|
|
4
|
-
module Processors
|
|
5
|
-
# Processes a rubric assessments report using the bulk importer.
|
|
6
|
-
#
|
|
7
|
-
# @param report_file_path [String]
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
class RubricAssessmentsProcessor < ReportProcessor
|
|
10
|
-
def self.process(report_file_path, _options, report_id)
|
|
11
|
-
new(report_file_path, _options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def initialize(report_file_path, options)
|
|
15
|
-
do_bulk_import(report_file_path, RubricAssessment, options: options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require_relative "./report_processor"
|
|
2
|
-
|
|
3
|
-
module CanvasSync
|
|
4
|
-
module Processors
|
|
5
|
-
# Processes a rubric association report using the bulk importer.
|
|
6
|
-
#
|
|
7
|
-
# @param report_file_path [String]
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
class RubricAssociationsProcessor < ReportProcessor
|
|
10
|
-
def self.process(report_file_path, _options, report_id)
|
|
11
|
-
new(report_file_path, _options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def initialize(report_file_path, options)
|
|
15
|
-
do_bulk_import(report_file_path, RubricAssociation, options: options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require_relative "./report_processor"
|
|
2
|
-
|
|
3
|
-
module CanvasSync
|
|
4
|
-
module Processors
|
|
5
|
-
# Processes a rubrics report using the bulk importer.
|
|
6
|
-
#
|
|
7
|
-
# @param report_file_path [String]
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
class RubricsProcessor < ReportProcessor
|
|
10
|
-
def self.process(report_file_path, _options, report_id)
|
|
11
|
-
new(report_file_path, _options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def initialize(report_file_path, options)
|
|
15
|
-
do_bulk_import(report_file_path, Rubric, options: options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require_relative "./report_processor"
|
|
2
|
-
|
|
3
|
-
module CanvasSync
|
|
4
|
-
module Processors
|
|
5
|
-
# Processes a submissions report using the bulk importer.
|
|
6
|
-
#
|
|
7
|
-
# @param report_file_path [String]
|
|
8
|
-
# @param options [Hash]
|
|
9
|
-
class SubmissionsProcessor < ReportProcessor
|
|
10
|
-
def self.process(report_file_path, _options, report_id)
|
|
11
|
-
new(report_file_path, _options)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def initialize(report_file_path, options)
|
|
15
|
-
do_bulk_import(report_file_path, Submission, options: options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::ReportChecker do
|
|
4
|
-
let(:client_double) { double('client') }
|
|
5
|
-
let(:report_id) { 1 }
|
|
6
|
-
let(:report_name) { 'provisioning_csv' }
|
|
7
|
-
let(:processor) { 'FakeProcessor' }
|
|
8
|
-
|
|
9
|
-
describe '#perform' do
|
|
10
|
-
def start_job
|
|
11
|
-
CanvasSync::Jobs::ReportChecker.perform_now(
|
|
12
|
-
'provisioning_csv',
|
|
13
|
-
report_id,
|
|
14
|
-
processor,
|
|
15
|
-
{}
|
|
16
|
-
)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
context 'the report has finished' do
|
|
20
|
-
it 'enqueues the report processor job' do
|
|
21
|
-
expect_any_instance_of(Bearcat::Client).to receive(:report_status)
|
|
22
|
-
.with('self', report_name, report_id)
|
|
23
|
-
.and_return({ 'status' => 'complete', 'attachment' => { 'url' => 'blah' } })
|
|
24
|
-
|
|
25
|
-
expect(CanvasSync::Jobs::ReportProcessorJob).to receive(:perform_later)
|
|
26
|
-
.with(report_name, 'blah', processor, {}, report_id)
|
|
27
|
-
|
|
28
|
-
start_job
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context 'the report is still running' do
|
|
33
|
-
it 're-enqueues the report checker' do
|
|
34
|
-
expect_any_instance_of(Bearcat::Client).to receive(:report_status)
|
|
35
|
-
.with('self', report_name, report_id)
|
|
36
|
-
.and_return({ 'status' => 'running' })
|
|
37
|
-
|
|
38
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
39
|
-
|
|
40
|
-
start_job
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context 'the report has errored' do
|
|
45
|
-
it 'does not re-enqueue the job or enqueue the processor' do
|
|
46
|
-
expect_any_instance_of(Bearcat::Client).to receive(:report_status)
|
|
47
|
-
.with('self', report_name, report_id)
|
|
48
|
-
.and_return({ 'status' => 'error' })
|
|
49
|
-
|
|
50
|
-
expect(CanvasSync::Jobs::ReportChecker).to_not receive(:set)
|
|
51
|
-
expect(CanvasSync::Jobs::ReportProcessorJob).to_not receive(:perform_later)
|
|
52
|
-
|
|
53
|
-
expect { start_job }.to raise_error
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
class FakeProcessor; end;
|
|
4
|
-
|
|
5
|
-
RSpec.describe CanvasSync::Jobs::ReportProcessorJob do
|
|
6
|
-
let(:report_name) { 'provisioning_csv' }
|
|
7
|
-
let(:report_url) { 'https://test.instructure.com/sample_report_download' }
|
|
8
|
-
let(:processor) { FakeProcessor.to_s }
|
|
9
|
-
let(:report_id) { 1 }
|
|
10
|
-
|
|
11
|
-
describe '#perform' do
|
|
12
|
-
it 'downloads the report to a file and then calls the process method on the processor, and then invokes the next job' do
|
|
13
|
-
expect_any_instance_of(Bearcat::Client).to receive(:download_report)
|
|
14
|
-
expect(FakeProcessor).to receive(:process)
|
|
15
|
-
|
|
16
|
-
CanvasSync::Jobs::ReportProcessorJob.perform_now(
|
|
17
|
-
report_name,
|
|
18
|
-
report_url,
|
|
19
|
-
processor,
|
|
20
|
-
{},
|
|
21
|
-
report_id,
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncAssignmentGroupsJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "a term id is in the global_options" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_assignment_group_export_csv for the given term" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_assignment_group_export_csv", { parameters: { enrollment_term_id: 1 } })
|
|
9
|
-
.and_return("id" => 1)
|
|
10
|
-
|
|
11
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
12
|
-
|
|
13
|
-
set_batch_context(canvas_term_id: 1)
|
|
14
|
-
CanvasSync::Jobs::SyncAssignmentGroupsJob.perform_now({})
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncAssignmentsJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "a term id is in the global_options" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_assignment_export_csv for the given term" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_assignment_export_csv", { parameters: { enrollment_term_id: 1 } })
|
|
9
|
-
.and_return("id" => 1)
|
|
10
|
-
|
|
11
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
12
|
-
|
|
13
|
-
set_batch_context(canvas_term_id: 1)
|
|
14
|
-
CanvasSync::Jobs::SyncAssignmentsJob.perform_now({})
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "no term id is specified" do
|
|
19
|
-
it "enqueues a ReportStarter for the proserv_assignment_export_csv for all terms" do
|
|
20
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
21
|
-
.with("self", "proserv_assignment_export_csv", { parameters: {} })
|
|
22
|
-
.and_return("id" => 1)
|
|
23
|
-
|
|
24
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
25
|
-
|
|
26
|
-
CanvasSync::Jobs::SyncAssignmentsJob.perform_now({})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncContentMigrationsJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "no parameters is specified" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_content_migrations_csv" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_content_migrations_csv", { parameters: { } })
|
|
9
|
-
.and_return("id" => 1)
|
|
10
|
-
|
|
11
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
12
|
-
|
|
13
|
-
CanvasSync::Jobs::SyncContentMigrationsJob.perform_now({})
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context "updated_after parameters is specified" do
|
|
18
|
-
it "enqueues a ReportStarter for the proserv_content_migrations_csv and get data from given date" do
|
|
19
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
20
|
-
.with("self", "proserv_content_migrations_csv", { parameters: { updated_after: 6.hours.ago.to_s } })
|
|
21
|
-
.and_return("id" => 1)
|
|
22
|
-
|
|
23
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
24
|
-
|
|
25
|
-
set_batch_context(updated_after: 6.hours.ago.to_s)
|
|
26
|
-
CanvasSync::Jobs::SyncContentMigrationsJob.perform_now({})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncContextModuleItemsJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "a term id is in the global_options" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_context_module_items_csv for the given term" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_context_module_items_csv", { parameters: { enrollment_term_id: 1 } })
|
|
9
|
-
.and_return("id" => 1)
|
|
10
|
-
|
|
11
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
12
|
-
|
|
13
|
-
set_batch_context(canvas_term_id: 1)
|
|
14
|
-
CanvasSync::Jobs::SyncContextModuleItemsJob.perform_now({})
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "no term id is specified" do
|
|
19
|
-
it "enqueues a ReportStarter for the proserv_context_module_items_csv for all terms" do
|
|
20
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
21
|
-
.with("self", "proserv_context_module_items_csv", { parameters: { } })
|
|
22
|
-
.and_return("id" => 1)
|
|
23
|
-
|
|
24
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
25
|
-
|
|
26
|
-
CanvasSync::Jobs::SyncContextModuleItemsJob.perform_now({})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncContextModulesJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "a term id is in the global_options" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_context_modules_csv for the given term" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_context_modules_csv", { parameters: { enrollment_term_id: 1 } })
|
|
9
|
-
.and_return("id" => 1)
|
|
10
|
-
|
|
11
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
12
|
-
|
|
13
|
-
set_batch_context(canvas_term_id: 1)
|
|
14
|
-
CanvasSync::Jobs::SyncContextModulesJob.perform_now({})
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "no term id is specified" do
|
|
19
|
-
it "enqueues a ReportStarter for the proserv_context_modules_csv for all terms" do
|
|
20
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
21
|
-
.with("self", "proserv_context_modules_csv", { parameters: { } })
|
|
22
|
-
.and_return("id" => 1)
|
|
23
|
-
|
|
24
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
25
|
-
|
|
26
|
-
CanvasSync::Jobs::SyncContextModulesJob.perform_now({})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncScoresJob do
|
|
4
|
-
describe '#perform' do
|
|
5
|
-
it "enqueues a ReportStarter for the proserv_assignment_export_csv for all terms" do
|
|
6
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
7
|
-
.with("self", "proserv_scores_data_csv", { parameters: {} })
|
|
8
|
-
.and_return("id" => 1)
|
|
9
|
-
|
|
10
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
11
|
-
|
|
12
|
-
CanvasSync::Jobs::SyncScoresJob.perform_now({})
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
RSpec.describe CanvasSync::Jobs::SyncSubmissionsJob do
|
|
4
|
-
describe "#perform" do
|
|
5
|
-
context "a term id is in the global_options" do
|
|
6
|
-
it "enqueues a ReportStarter for the proserv_student_submissions_csv for the given term" do
|
|
7
|
-
expect_any_instance_of(Bearcat::Client).to receive(:start_report)
|
|
8
|
-
.with("self", "proserv_student_submissions_csv", { parameters: {
|
|
9
|
-
enrollment_term_id: 1,
|
|
10
|
-
include_all: nil,
|
|
11
|
-
enrollment_batch_size: nil,
|
|
12
|
-
include_all_except: nil
|
|
13
|
-
} })
|
|
14
|
-
.and_return("id" => 1)
|
|
15
|
-
|
|
16
|
-
expect(CanvasSync::Jobs::ReportChecker).to receive(:set).and_call_original
|
|
17
|
-
|
|
18
|
-
set_batch_context(canvas_term_id: 1)
|
|
19
|
-
CanvasSync::Jobs::SyncSubmissionsJob.perform_now({})
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|