moodle2cc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/Guardfile +14 -0
- data/LICENSE +661 -0
- data/README.md +38 -0
- data/Rakefile +12 -0
- data/bin/moodle2cc +6 -0
- data/lib/moodle2cc.rb +60 -0
- data/lib/moodle2cc/canvas/.converter.rb.swo +0 -0
- data/lib/moodle2cc/canvas/.wiki.rb.swo +0 -0
- data/lib/moodle2cc/canvas/assessment.rb +109 -0
- data/lib/moodle2cc/canvas/assignment.rb +108 -0
- data/lib/moodle2cc/canvas/converter.rb +28 -0
- data/lib/moodle2cc/canvas/course.rb +145 -0
- data/lib/moodle2cc/canvas/discussion_topic.rb +64 -0
- data/lib/moodle2cc/canvas/label.rb +8 -0
- data/lib/moodle2cc/canvas/question.rb +468 -0
- data/lib/moodle2cc/canvas/question_bank.rb +54 -0
- data/lib/moodle2cc/canvas/resource.rb +16 -0
- data/lib/moodle2cc/canvas/templates/assignment.html.erb +9 -0
- data/lib/moodle2cc/canvas/templates/syllabus.html.erb +9 -0
- data/lib/moodle2cc/canvas/templates/wiki_content.html.erb +10 -0
- data/lib/moodle2cc/canvas/web_content.rb +10 -0
- data/lib/moodle2cc/canvas/web_link.rb +17 -0
- data/lib/moodle2cc/canvas/wiki.rb +25 -0
- data/lib/moodle2cc/cc/assessment.rb +25 -0
- data/lib/moodle2cc/cc/assignment.rb +66 -0
- data/lib/moodle2cc/cc/cc_helper.rb +282 -0
- data/lib/moodle2cc/cc/converter.rb +136 -0
- data/lib/moodle2cc/cc/course.rb +16 -0
- data/lib/moodle2cc/cc/discussion_topic.rb +53 -0
- data/lib/moodle2cc/cc/label.rb +6 -0
- data/lib/moodle2cc/cc/question.rb +23 -0
- data/lib/moodle2cc/cc/resource.rb +30 -0
- data/lib/moodle2cc/cc/templates/assignment.html.erb +9 -0
- data/lib/moodle2cc/cc/templates/syllabus.html.erb +9 -0
- data/lib/moodle2cc/cc/templates/wiki_content.html.erb +10 -0
- data/lib/moodle2cc/cc/web_content.rb +40 -0
- data/lib/moodle2cc/cc/web_link.rb +53 -0
- data/lib/moodle2cc/cc/wiki.rb +72 -0
- data/lib/moodle2cc/cli.rb +14 -0
- data/lib/moodle2cc/error.rb +3 -0
- data/lib/moodle2cc/migrator.rb +23 -0
- data/lib/moodle2cc/moodle/backup.rb +38 -0
- data/lib/moodle2cc/moodle/course.rb +24 -0
- data/lib/moodle2cc/moodle/grade_item.rb +24 -0
- data/lib/moodle2cc/moodle/info.rb +8 -0
- data/lib/moodle2cc/moodle/mod.rb +127 -0
- data/lib/moodle2cc/moodle/question.rb +98 -0
- data/lib/moodle2cc/moodle/question_category.rb +17 -0
- data/lib/moodle2cc/moodle/section.rb +37 -0
- data/lib/moodle2cc/resource_factory.rb +32 -0
- data/lib/moodle2cc/version.rb +3 -0
- data/moodle2cc.gemspec +29 -0
- data/test/acceptance/migrator_test.rb +23 -0
- data/test/fixtures/cc.imscc +0 -0
- data/test/fixtures/moodle_backup/course_files/folder/test.txt +1 -0
- data/test/fixtures/moodle_backup/course_files/test.txt +1 -0
- data/test/fixtures/moodle_backup/moodle.xml +916 -0
- data/test/test_helper.rb +43 -0
- data/test/test_question_helper.rb +107 -0
- data/test/test_wiki_helper.rb +21 -0
- data/test/unit/canvas/assessment_test.rb +218 -0
- data/test/unit/canvas/assignment_test.rb +220 -0
- data/test/unit/canvas/converter_test.rb +159 -0
- data/test/unit/canvas/course_test.rb +176 -0
- data/test/unit/canvas/discussion_topic_test.rb +129 -0
- data/test/unit/canvas/label_test.rb +32 -0
- data/test/unit/canvas/question_bank_test.rb +73 -0
- data/test/unit/canvas/question_test.rb +824 -0
- data/test/unit/canvas/web_content_test.rb +37 -0
- data/test/unit/canvas/web_link_test.rb +48 -0
- data/test/unit/canvas/wiki_test.rb +74 -0
- data/test/unit/cc/assessment_test.rb +48 -0
- data/test/unit/cc/assignment_test.rb +67 -0
- data/test/unit/cc/cc_helper_test.rb +19 -0
- data/test/unit/cc/converter_test.rb +159 -0
- data/test/unit/cc/course_test.rb +36 -0
- data/test/unit/cc/discussion_topic_test.rb +83 -0
- data/test/unit/cc/label_test.rb +29 -0
- data/test/unit/cc/question_test.rb +49 -0
- data/test/unit/cc/web_content_test.rb +76 -0
- data/test/unit/cc/web_link_test.rb +79 -0
- data/test/unit/cc/wiki_test.rb +139 -0
- data/test/unit/migrator_test.rb +56 -0
- data/test/unit/moodle/backup_test.rb +30 -0
- data/test/unit/moodle/course_test.rb +57 -0
- data/test/unit/moodle/grade_item_test.rb +72 -0
- data/test/unit/moodle/info_test.rb +21 -0
- data/test/unit/moodle/mod_test.rb +301 -0
- data/test/unit/moodle/question_category_test.rb +34 -0
- data/test/unit/moodle/question_test.rb +185 -0
- data/test/unit/moodle/section_test.rb +75 -0
- data/test/unit/resource_factory_test.rb +119 -0
- metadata +342 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'test/test_helper'
|
3
|
+
require 'moodle2cc'
|
4
|
+
|
5
|
+
class TestUnitMoodleQuestionCategory < MiniTest::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@moodle_backup_path = create_moodle_backup_zip
|
10
|
+
@backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
|
11
|
+
@course = @backup.course
|
12
|
+
@question_category = @course.question_categories.first
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
clean_tmp_folder
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_it_has_an_id
|
20
|
+
assert_equal 121, @question_category.id
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_it_has_a_name
|
24
|
+
assert_equal 'Default for Beginning Ruby on Rails', @question_category.name
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_it_has_info
|
28
|
+
assert_equal "The default category for questions shared in context 'Beginning Ruby on Rails'.", @question_category.info
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_it_has_questions
|
32
|
+
assert @question_category.questions.length > 0, 'question_category has no questions'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'test/test_helper'
|
3
|
+
require 'moodle2cc'
|
4
|
+
|
5
|
+
class TestUnitMoodleQuestion < MiniTest::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@moodle_backup_path = create_moodle_backup_zip
|
10
|
+
@backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
|
11
|
+
@course = @backup.course
|
12
|
+
@questionnaire_mod = @course.mods.find { |mod| mod.mod_type == 'questionnaire' }
|
13
|
+
@question_category = @course.question_categories.first
|
14
|
+
|
15
|
+
@calculated_question = @question_category.questions.find { |q| q.type == 'calculated' }
|
16
|
+
@match_question = @question_category.questions.find { |q| q.type == 'match' }
|
17
|
+
@numerical_question = @question_category.questions.find { |q| q.type == 'numerical' }
|
18
|
+
@questionnaire_question = @questionnaire_mod.questions.last
|
19
|
+
|
20
|
+
@answer = @calculated_question.answers.first
|
21
|
+
@calculation = @calculated_question.calculations.first
|
22
|
+
@dataset_definition = @calculation.dataset_definitions.first
|
23
|
+
@dataset_item = @dataset_definition.dataset_items.first
|
24
|
+
|
25
|
+
@match = @match_question.matches.first
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
clean_tmp_folder
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_it_has_an_id
|
33
|
+
assert_equal 989, @calculated_question.id
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_it_has_a_name
|
37
|
+
assert_equal 'Basic Arithmetic', @calculated_question.name
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_it_has_text
|
41
|
+
assert_equal 'How much is {a} + {b} ?', @calculated_question.text
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_it_has_general_feedback
|
45
|
+
assert_equal 'This should be easy', @calculated_question.general_feedback
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_it_has_default_grade
|
49
|
+
assert_equal 1, @calculated_question.default_grade
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_it_has_a_type
|
53
|
+
assert_equal 'calculated', @calculated_question.type
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_it_has_a_position
|
57
|
+
assert_equal 2, @questionnaire_question.position
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_it_has_length
|
61
|
+
assert_equal 1, @calculated_question.length
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_it_has_a_type_id
|
65
|
+
assert_equal 5, @questionnaire_question.type_id
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_it_has_content
|
69
|
+
assert_equal 'Are you experienced?', @questionnaire_question.content
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_it_has_question_choices
|
73
|
+
assert @questionnaire_question.choices.length > 0, 'questionnaire question has no choices'
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_choice_has_an_id
|
77
|
+
assert_equal 1, @questionnaire_question.choices.first.id
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_choice_has_content
|
81
|
+
assert_equal 'Yes', @questionnaire_question.choices.first.content
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_it_has_calculations
|
85
|
+
assert @calculated_question.calculations.length > 0, 'question has no calculations'
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_calculation_has_answer_id
|
89
|
+
assert_equal 16, @calculation.answer_id
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_calculation_has_a_tolerance
|
93
|
+
assert_equal 0.01, @calculation.tolerance
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_calculation_has_a_correct_answer_length
|
97
|
+
assert_equal 2, @calculation.correct_answer_length
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_calculation_has_a_correct_answer_format
|
101
|
+
assert_equal 1, @calculation.correct_answer_format
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_calculation_has_dataset_definitions
|
105
|
+
assert @calculation.dataset_definitions.length > 0, 'calculation does not have dataset_definitions'
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_dataset_definition_has_a_name
|
109
|
+
assert_equal 'a', @dataset_definition.name
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_dataset_definition_has_options
|
113
|
+
assert_equal 'uniform:1.0:10.0:1', @dataset_definition.options
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_dataset_definition_has_dataset_items
|
117
|
+
assert @dataset_definition.dataset_items.length > 0, 'dataset_definition does not have dataset_items'
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_dataset_item_has_a_number
|
121
|
+
assert_equal 1, @dataset_item.number
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_dataset_item_has_a_value
|
125
|
+
assert_equal 3.0, @dataset_item.value
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_it_has_numericals
|
129
|
+
assert @numerical_question.numericals.length > 0, 'question does not have numericals'
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_numericals_has_an_answer_id
|
133
|
+
assert_equal 43, @numerical_question.numericals.first.answer_id
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_numericals_has_a_tolerance
|
137
|
+
assert_equal 2, @numerical_question.numericals.first.tolerance
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_it_has_answers
|
141
|
+
assert @calculated_question.answers.length > 0, 'question does not have answers'
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_answer_has_an_id
|
145
|
+
assert_equal 16, @answer.id
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_answer_has_text
|
149
|
+
assert_equal '{a} + {b}', @answer.text
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_answer_has_a_fraction
|
153
|
+
assert_equal 1.0, @answer.fraction
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_answer_has_feedback
|
157
|
+
assert_equal 'Great job!', @answer.feedback
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_it_has_matches
|
161
|
+
assert @match_question.matches.length > 0, 'question does not have matches'
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_match_has_an_id
|
165
|
+
assert_equal 7, @match.id
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_match_has_a_code
|
169
|
+
assert_equal 400458432, @match.code
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_match_has_question_text
|
173
|
+
assert_equal 'Ruby on Rails is written in this language', @match.question_text
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_match_has_answer_text
|
177
|
+
assert_equal 'Ruby', @match.answer_text
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_it_has_an_instance
|
181
|
+
quiz_mod = @course.mods.find { |mod| mod.mod_type == 'quiz' }
|
182
|
+
instance = quiz_mod.question_instances.find { |i| i.question_id == @calculated_question.id }
|
183
|
+
assert_equal instance, @calculated_question.instance
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'test/test_helper'
|
3
|
+
require 'moodle2cc'
|
4
|
+
|
5
|
+
class TestUnitMoodleSection < MiniTest::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@moodle_backup_path = create_moodle_backup_zip
|
10
|
+
@backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
|
11
|
+
@course = @backup.course
|
12
|
+
@sections = @course.sections
|
13
|
+
@section = @sections.first
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
clean_tmp_folder
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_it_has_a_course
|
21
|
+
assert_equal @course, @section.course
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_it_has_all_the_sections
|
25
|
+
assert_equal 3, @sections.length
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_it_has_an_id
|
29
|
+
assert_equal 12345, @section.id
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_it_has_a_number
|
33
|
+
assert_equal 0, @section.number
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_it_has_a_summary
|
37
|
+
assert_equal "<h1>This is the Syllabus</h1>", @section.summary
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_it_has_a_visibility
|
41
|
+
assert_equal true, @section.visible
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_it_has_mods
|
45
|
+
assert @section.mods.length > 0
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_mods_have_an_id
|
49
|
+
assert 11111, @section.mods.first.id
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_mods_have_an_instance_id
|
53
|
+
assert 987, @section.mods.first.instance_id
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_mods_have_an_indent
|
57
|
+
assert_equal 0, @section.mods[0].indent
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_mods_have_a_visibility
|
61
|
+
assert_equal true, @section.mods[0].visible
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_mods_have_instances
|
65
|
+
assert_equal @course.mods.first.id, @section.mods.first.instance.id
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_mods_have_added
|
69
|
+
assert_equal 1338410699, @section.mods.first.added
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_mods_have_a_mod_type
|
73
|
+
assert_equal 'assignment', @section.mods.first.mod_type
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'test/test_helper'
|
3
|
+
require 'moodle2cc'
|
4
|
+
|
5
|
+
class TestUnitCCResource < MiniTest::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@cc_factory = Moodle2CC::ResourceFactory.new Moodle2CC::CC
|
10
|
+
@canvas_factory = Moodle2CC::ResourceFactory.new Moodle2CC::Canvas
|
11
|
+
convert_moodle_backup
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
clean_tmp_folder
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_it_can_get_assessment_resource
|
19
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "quiz" }
|
20
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
21
|
+
assert_kind_of Moodle2CC::CC::Assessment, resource
|
22
|
+
|
23
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
24
|
+
assert_kind_of Moodle2CC::Canvas::Assessment, resource
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_it_can_get_assignment_resource
|
28
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "assignment" }
|
29
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
30
|
+
assert_kind_of Moodle2CC::CC::Assignment, resource
|
31
|
+
|
32
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
33
|
+
assert_kind_of Moodle2CC::Canvas::Assignment, resource
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_it_can_get_discussion_topic_resource
|
37
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "forum" }
|
38
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
39
|
+
assert_kind_of Moodle2CC::CC::DiscussionTopic, resource
|
40
|
+
|
41
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
42
|
+
assert_kind_of Moodle2CC::Canvas::DiscussionTopic, resource
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_it_can_get_web_content_resource
|
46
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "resource" }
|
47
|
+
mod.type = 'html'
|
48
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
49
|
+
assert_kind_of Moodle2CC::CC::WebContent, resource
|
50
|
+
|
51
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
52
|
+
assert_kind_of Moodle2CC::Canvas::WebContent, resource
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_it_can_get_web_link_resource
|
56
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "resource" }
|
57
|
+
mod.type = 'file'
|
58
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
59
|
+
assert_kind_of Moodle2CC::CC::WebLink, resource
|
60
|
+
|
61
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
62
|
+
assert_kind_of Moodle2CC::Canvas::WebLink, resource
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_it_can_get_wiki_resource
|
66
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "wiki" }
|
67
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
68
|
+
assert_kind_of Moodle2CC::CC::Wiki, resource
|
69
|
+
|
70
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
71
|
+
assert_kind_of Moodle2CC::Canvas::Wiki, resource
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_it_can_get_label_resource
|
75
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "label" }
|
76
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
77
|
+
assert_kind_of Moodle2CC::CC::Label, resource
|
78
|
+
|
79
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
80
|
+
assert_kind_of Moodle2CC::Canvas::Label, resource
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_it_can_get_web_content_resource_from_label_mod
|
84
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "label" }
|
85
|
+
mod.content = %(<img src="http://image.com/image.jpg" />")
|
86
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
87
|
+
assert_kind_of Moodle2CC::CC::WebContent, resource
|
88
|
+
|
89
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
90
|
+
assert_kind_of Moodle2CC::Canvas::WebContent, resource
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_it_can_get_assessment_resource_from_questionnaire_mod
|
94
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "questionnaire" }
|
95
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
96
|
+
assert_kind_of Moodle2CC::CC::Assessment, resource
|
97
|
+
|
98
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
99
|
+
assert_kind_of Moodle2CC::Canvas::Assessment, resource
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_it_can_get_assessment_resource_from_choice_mod
|
103
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "choice" }
|
104
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
105
|
+
assert_kind_of Moodle2CC::CC::Assessment, resource
|
106
|
+
|
107
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
108
|
+
assert_kind_of Moodle2CC::Canvas::Assessment, resource
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_it_can_get_assignment_resource_from_workshop_mod
|
112
|
+
mod = @backup.course.mods.find { |m| m.mod_type == "workshop" }
|
113
|
+
resource = @cc_factory.get_resource_from_mod(mod)
|
114
|
+
assert_kind_of Moodle2CC::CC::Assignment, resource
|
115
|
+
|
116
|
+
resource = @canvas_factory.get_resource_from_mod(mod)
|
117
|
+
assert_kind_of Moodle2CC::Canvas::Assignment, resource
|
118
|
+
end
|
119
|
+
end
|
metadata
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moodle2cc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Christopher Durtschi
|
14
|
+
- Kevin Carter
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2012-07-23 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rubyzip
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: happymapper
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: builder
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: thor
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: nokogiri
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :runtime
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rake
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: minitest
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
type: :development
|
118
|
+
version_requirements: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: guard
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id008
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: guard-bundler
|
135
|
+
prerelease: false
|
136
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
type: :development
|
146
|
+
version_requirements: *id009
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: guard-minitest
|
149
|
+
prerelease: false
|
150
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
hash: 3
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
version: "0"
|
159
|
+
type: :development
|
160
|
+
version_requirements: *id010
|
161
|
+
description: Migrates Moodle backup ZIP to IMS Common Cartridge package
|
162
|
+
email:
|
163
|
+
- christopher.durtschi@gmail.com
|
164
|
+
- cartkev@gmail.com
|
165
|
+
executables:
|
166
|
+
- moodle2cc
|
167
|
+
extensions: []
|
168
|
+
|
169
|
+
extra_rdoc_files: []
|
170
|
+
|
171
|
+
files:
|
172
|
+
- .gitignore
|
173
|
+
- Gemfile
|
174
|
+
- Guardfile
|
175
|
+
- LICENSE
|
176
|
+
- README.md
|
177
|
+
- Rakefile
|
178
|
+
- bin/moodle2cc
|
179
|
+
- lib/moodle2cc.rb
|
180
|
+
- lib/moodle2cc/canvas/.converter.rb.swo
|
181
|
+
- lib/moodle2cc/canvas/.wiki.rb.swo
|
182
|
+
- lib/moodle2cc/canvas/assessment.rb
|
183
|
+
- lib/moodle2cc/canvas/assignment.rb
|
184
|
+
- lib/moodle2cc/canvas/converter.rb
|
185
|
+
- lib/moodle2cc/canvas/course.rb
|
186
|
+
- lib/moodle2cc/canvas/discussion_topic.rb
|
187
|
+
- lib/moodle2cc/canvas/label.rb
|
188
|
+
- lib/moodle2cc/canvas/question.rb
|
189
|
+
- lib/moodle2cc/canvas/question_bank.rb
|
190
|
+
- lib/moodle2cc/canvas/resource.rb
|
191
|
+
- lib/moodle2cc/canvas/templates/assignment.html.erb
|
192
|
+
- lib/moodle2cc/canvas/templates/syllabus.html.erb
|
193
|
+
- lib/moodle2cc/canvas/templates/wiki_content.html.erb
|
194
|
+
- lib/moodle2cc/canvas/web_content.rb
|
195
|
+
- lib/moodle2cc/canvas/web_link.rb
|
196
|
+
- lib/moodle2cc/canvas/wiki.rb
|
197
|
+
- lib/moodle2cc/cc/assessment.rb
|
198
|
+
- lib/moodle2cc/cc/assignment.rb
|
199
|
+
- lib/moodle2cc/cc/cc_helper.rb
|
200
|
+
- lib/moodle2cc/cc/converter.rb
|
201
|
+
- lib/moodle2cc/cc/course.rb
|
202
|
+
- lib/moodle2cc/cc/discussion_topic.rb
|
203
|
+
- lib/moodle2cc/cc/label.rb
|
204
|
+
- lib/moodle2cc/cc/question.rb
|
205
|
+
- lib/moodle2cc/cc/resource.rb
|
206
|
+
- lib/moodle2cc/cc/templates/assignment.html.erb
|
207
|
+
- lib/moodle2cc/cc/templates/syllabus.html.erb
|
208
|
+
- lib/moodle2cc/cc/templates/wiki_content.html.erb
|
209
|
+
- lib/moodle2cc/cc/web_content.rb
|
210
|
+
- lib/moodle2cc/cc/web_link.rb
|
211
|
+
- lib/moodle2cc/cc/wiki.rb
|
212
|
+
- lib/moodle2cc/cli.rb
|
213
|
+
- lib/moodle2cc/error.rb
|
214
|
+
- lib/moodle2cc/migrator.rb
|
215
|
+
- lib/moodle2cc/moodle/backup.rb
|
216
|
+
- lib/moodle2cc/moodle/course.rb
|
217
|
+
- lib/moodle2cc/moodle/grade_item.rb
|
218
|
+
- lib/moodle2cc/moodle/info.rb
|
219
|
+
- lib/moodle2cc/moodle/mod.rb
|
220
|
+
- lib/moodle2cc/moodle/question.rb
|
221
|
+
- lib/moodle2cc/moodle/question_category.rb
|
222
|
+
- lib/moodle2cc/moodle/section.rb
|
223
|
+
- lib/moodle2cc/resource_factory.rb
|
224
|
+
- lib/moodle2cc/version.rb
|
225
|
+
- moodle2cc.gemspec
|
226
|
+
- test/acceptance/migrator_test.rb
|
227
|
+
- test/fixtures/cc.imscc
|
228
|
+
- test/fixtures/moodle_backup/course_files/folder/test.txt
|
229
|
+
- test/fixtures/moodle_backup/course_files/test.txt
|
230
|
+
- test/fixtures/moodle_backup/moodle.xml
|
231
|
+
- test/test_helper.rb
|
232
|
+
- test/test_question_helper.rb
|
233
|
+
- test/test_wiki_helper.rb
|
234
|
+
- test/tmp/.gitkeep
|
235
|
+
- test/unit/canvas/assessment_test.rb
|
236
|
+
- test/unit/canvas/assignment_test.rb
|
237
|
+
- test/unit/canvas/converter_test.rb
|
238
|
+
- test/unit/canvas/course_test.rb
|
239
|
+
- test/unit/canvas/discussion_topic_test.rb
|
240
|
+
- test/unit/canvas/label_test.rb
|
241
|
+
- test/unit/canvas/question_bank_test.rb
|
242
|
+
- test/unit/canvas/question_test.rb
|
243
|
+
- test/unit/canvas/web_content_test.rb
|
244
|
+
- test/unit/canvas/web_link_test.rb
|
245
|
+
- test/unit/canvas/wiki_test.rb
|
246
|
+
- test/unit/cc/assessment_test.rb
|
247
|
+
- test/unit/cc/assignment_test.rb
|
248
|
+
- test/unit/cc/cc_helper_test.rb
|
249
|
+
- test/unit/cc/converter_test.rb
|
250
|
+
- test/unit/cc/course_test.rb
|
251
|
+
- test/unit/cc/discussion_topic_test.rb
|
252
|
+
- test/unit/cc/label_test.rb
|
253
|
+
- test/unit/cc/question_test.rb
|
254
|
+
- test/unit/cc/web_content_test.rb
|
255
|
+
- test/unit/cc/web_link_test.rb
|
256
|
+
- test/unit/cc/wiki_test.rb
|
257
|
+
- test/unit/migrator_test.rb
|
258
|
+
- test/unit/moodle/backup_test.rb
|
259
|
+
- test/unit/moodle/course_test.rb
|
260
|
+
- test/unit/moodle/grade_item_test.rb
|
261
|
+
- test/unit/moodle/info_test.rb
|
262
|
+
- test/unit/moodle/mod_test.rb
|
263
|
+
- test/unit/moodle/question_category_test.rb
|
264
|
+
- test/unit/moodle/question_test.rb
|
265
|
+
- test/unit/moodle/section_test.rb
|
266
|
+
- test/unit/resource_factory_test.rb
|
267
|
+
homepage: ""
|
268
|
+
licenses: []
|
269
|
+
|
270
|
+
post_install_message:
|
271
|
+
rdoc_options: []
|
272
|
+
|
273
|
+
require_paths:
|
274
|
+
- lib
|
275
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
276
|
+
none: false
|
277
|
+
requirements:
|
278
|
+
- - ">="
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
hash: 3
|
281
|
+
segments:
|
282
|
+
- 0
|
283
|
+
version: "0"
|
284
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
285
|
+
none: false
|
286
|
+
requirements:
|
287
|
+
- - ">="
|
288
|
+
- !ruby/object:Gem::Version
|
289
|
+
hash: 3
|
290
|
+
segments:
|
291
|
+
- 0
|
292
|
+
version: "0"
|
293
|
+
requirements: []
|
294
|
+
|
295
|
+
rubyforge_project:
|
296
|
+
rubygems_version: 1.8.15
|
297
|
+
signing_key:
|
298
|
+
specification_version: 3
|
299
|
+
summary: Migrates Moodle backup ZIP to IMS Common Cartridge package
|
300
|
+
test_files:
|
301
|
+
- test/acceptance/migrator_test.rb
|
302
|
+
- test/fixtures/cc.imscc
|
303
|
+
- test/fixtures/moodle_backup/course_files/folder/test.txt
|
304
|
+
- test/fixtures/moodle_backup/course_files/test.txt
|
305
|
+
- test/fixtures/moodle_backup/moodle.xml
|
306
|
+
- test/test_helper.rb
|
307
|
+
- test/test_question_helper.rb
|
308
|
+
- test/test_wiki_helper.rb
|
309
|
+
- test/tmp/.gitkeep
|
310
|
+
- test/unit/canvas/assessment_test.rb
|
311
|
+
- test/unit/canvas/assignment_test.rb
|
312
|
+
- test/unit/canvas/converter_test.rb
|
313
|
+
- test/unit/canvas/course_test.rb
|
314
|
+
- test/unit/canvas/discussion_topic_test.rb
|
315
|
+
- test/unit/canvas/label_test.rb
|
316
|
+
- test/unit/canvas/question_bank_test.rb
|
317
|
+
- test/unit/canvas/question_test.rb
|
318
|
+
- test/unit/canvas/web_content_test.rb
|
319
|
+
- test/unit/canvas/web_link_test.rb
|
320
|
+
- test/unit/canvas/wiki_test.rb
|
321
|
+
- test/unit/cc/assessment_test.rb
|
322
|
+
- test/unit/cc/assignment_test.rb
|
323
|
+
- test/unit/cc/cc_helper_test.rb
|
324
|
+
- test/unit/cc/converter_test.rb
|
325
|
+
- test/unit/cc/course_test.rb
|
326
|
+
- test/unit/cc/discussion_topic_test.rb
|
327
|
+
- test/unit/cc/label_test.rb
|
328
|
+
- test/unit/cc/question_test.rb
|
329
|
+
- test/unit/cc/web_content_test.rb
|
330
|
+
- test/unit/cc/web_link_test.rb
|
331
|
+
- test/unit/cc/wiki_test.rb
|
332
|
+
- test/unit/migrator_test.rb
|
333
|
+
- test/unit/moodle/backup_test.rb
|
334
|
+
- test/unit/moodle/course_test.rb
|
335
|
+
- test/unit/moodle/grade_item_test.rb
|
336
|
+
- test/unit/moodle/info_test.rb
|
337
|
+
- test/unit/moodle/mod_test.rb
|
338
|
+
- test/unit/moodle/question_category_test.rb
|
339
|
+
- test/unit/moodle/question_test.rb
|
340
|
+
- test/unit/moodle/section_test.rb
|
341
|
+
- test/unit/resource_factory_test.rb
|
342
|
+
has_rdoc:
|