moodle2cc 0.0.1

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.
Files changed (95) hide show
  1. data/.gitignore +20 -0
  2. data/Gemfile +4 -0
  3. data/Guardfile +14 -0
  4. data/LICENSE +661 -0
  5. data/README.md +38 -0
  6. data/Rakefile +12 -0
  7. data/bin/moodle2cc +6 -0
  8. data/lib/moodle2cc.rb +60 -0
  9. data/lib/moodle2cc/canvas/.converter.rb.swo +0 -0
  10. data/lib/moodle2cc/canvas/.wiki.rb.swo +0 -0
  11. data/lib/moodle2cc/canvas/assessment.rb +109 -0
  12. data/lib/moodle2cc/canvas/assignment.rb +108 -0
  13. data/lib/moodle2cc/canvas/converter.rb +28 -0
  14. data/lib/moodle2cc/canvas/course.rb +145 -0
  15. data/lib/moodle2cc/canvas/discussion_topic.rb +64 -0
  16. data/lib/moodle2cc/canvas/label.rb +8 -0
  17. data/lib/moodle2cc/canvas/question.rb +468 -0
  18. data/lib/moodle2cc/canvas/question_bank.rb +54 -0
  19. data/lib/moodle2cc/canvas/resource.rb +16 -0
  20. data/lib/moodle2cc/canvas/templates/assignment.html.erb +9 -0
  21. data/lib/moodle2cc/canvas/templates/syllabus.html.erb +9 -0
  22. data/lib/moodle2cc/canvas/templates/wiki_content.html.erb +10 -0
  23. data/lib/moodle2cc/canvas/web_content.rb +10 -0
  24. data/lib/moodle2cc/canvas/web_link.rb +17 -0
  25. data/lib/moodle2cc/canvas/wiki.rb +25 -0
  26. data/lib/moodle2cc/cc/assessment.rb +25 -0
  27. data/lib/moodle2cc/cc/assignment.rb +66 -0
  28. data/lib/moodle2cc/cc/cc_helper.rb +282 -0
  29. data/lib/moodle2cc/cc/converter.rb +136 -0
  30. data/lib/moodle2cc/cc/course.rb +16 -0
  31. data/lib/moodle2cc/cc/discussion_topic.rb +53 -0
  32. data/lib/moodle2cc/cc/label.rb +6 -0
  33. data/lib/moodle2cc/cc/question.rb +23 -0
  34. data/lib/moodle2cc/cc/resource.rb +30 -0
  35. data/lib/moodle2cc/cc/templates/assignment.html.erb +9 -0
  36. data/lib/moodle2cc/cc/templates/syllabus.html.erb +9 -0
  37. data/lib/moodle2cc/cc/templates/wiki_content.html.erb +10 -0
  38. data/lib/moodle2cc/cc/web_content.rb +40 -0
  39. data/lib/moodle2cc/cc/web_link.rb +53 -0
  40. data/lib/moodle2cc/cc/wiki.rb +72 -0
  41. data/lib/moodle2cc/cli.rb +14 -0
  42. data/lib/moodle2cc/error.rb +3 -0
  43. data/lib/moodle2cc/migrator.rb +23 -0
  44. data/lib/moodle2cc/moodle/backup.rb +38 -0
  45. data/lib/moodle2cc/moodle/course.rb +24 -0
  46. data/lib/moodle2cc/moodle/grade_item.rb +24 -0
  47. data/lib/moodle2cc/moodle/info.rb +8 -0
  48. data/lib/moodle2cc/moodle/mod.rb +127 -0
  49. data/lib/moodle2cc/moodle/question.rb +98 -0
  50. data/lib/moodle2cc/moodle/question_category.rb +17 -0
  51. data/lib/moodle2cc/moodle/section.rb +37 -0
  52. data/lib/moodle2cc/resource_factory.rb +32 -0
  53. data/lib/moodle2cc/version.rb +3 -0
  54. data/moodle2cc.gemspec +29 -0
  55. data/test/acceptance/migrator_test.rb +23 -0
  56. data/test/fixtures/cc.imscc +0 -0
  57. data/test/fixtures/moodle_backup/course_files/folder/test.txt +1 -0
  58. data/test/fixtures/moodle_backup/course_files/test.txt +1 -0
  59. data/test/fixtures/moodle_backup/moodle.xml +916 -0
  60. data/test/test_helper.rb +43 -0
  61. data/test/test_question_helper.rb +107 -0
  62. data/test/test_wiki_helper.rb +21 -0
  63. data/test/unit/canvas/assessment_test.rb +218 -0
  64. data/test/unit/canvas/assignment_test.rb +220 -0
  65. data/test/unit/canvas/converter_test.rb +159 -0
  66. data/test/unit/canvas/course_test.rb +176 -0
  67. data/test/unit/canvas/discussion_topic_test.rb +129 -0
  68. data/test/unit/canvas/label_test.rb +32 -0
  69. data/test/unit/canvas/question_bank_test.rb +73 -0
  70. data/test/unit/canvas/question_test.rb +824 -0
  71. data/test/unit/canvas/web_content_test.rb +37 -0
  72. data/test/unit/canvas/web_link_test.rb +48 -0
  73. data/test/unit/canvas/wiki_test.rb +74 -0
  74. data/test/unit/cc/assessment_test.rb +48 -0
  75. data/test/unit/cc/assignment_test.rb +67 -0
  76. data/test/unit/cc/cc_helper_test.rb +19 -0
  77. data/test/unit/cc/converter_test.rb +159 -0
  78. data/test/unit/cc/course_test.rb +36 -0
  79. data/test/unit/cc/discussion_topic_test.rb +83 -0
  80. data/test/unit/cc/label_test.rb +29 -0
  81. data/test/unit/cc/question_test.rb +49 -0
  82. data/test/unit/cc/web_content_test.rb +76 -0
  83. data/test/unit/cc/web_link_test.rb +79 -0
  84. data/test/unit/cc/wiki_test.rb +139 -0
  85. data/test/unit/migrator_test.rb +56 -0
  86. data/test/unit/moodle/backup_test.rb +30 -0
  87. data/test/unit/moodle/course_test.rb +57 -0
  88. data/test/unit/moodle/grade_item_test.rb +72 -0
  89. data/test/unit/moodle/info_test.rb +21 -0
  90. data/test/unit/moodle/mod_test.rb +301 -0
  91. data/test/unit/moodle/question_category_test.rb +34 -0
  92. data/test/unit/moodle/question_test.rb +185 -0
  93. data/test/unit/moodle/section_test.rb +75 -0
  94. data/test/unit/resource_factory_test.rb +119 -0
  95. metadata +342 -0
@@ -0,0 +1,56 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMigrator < MiniTest::Unit::TestCase
6
+ include TestHelper
7
+
8
+ def setup
9
+ @valid_source = create_moodle_backup_zip
10
+ @valid_destination = File.expand_path("../../tmp", __FILE__)
11
+ end
12
+
13
+ def teardown
14
+ clean_tmp_folder
15
+ end
16
+
17
+ def test_it_accepts_a_source_and_destination
18
+ migrator = Moodle2CC::Migrator.new @valid_source, @valid_destination
19
+ assert migrator
20
+ end
21
+
22
+ def test_source_must_exist
23
+ assert_raises Moodle2CC::Error, "'does_not_exist' does not exist" do
24
+ Moodle2CC::Migrator.new 'does_not_exist', 'there'
25
+ end
26
+ end
27
+
28
+ def test_destination_must_be_a_directory
29
+ assert_raises Moodle2CC::Error, "'is_not_a_directory' is not a directory" do
30
+ Moodle2CC::Migrator.new @valid_source, 'is_not_a_directory'
31
+ end
32
+ end
33
+
34
+ def test_it_allows_cc_format
35
+ migrator = Moodle2CC::Migrator.new @valid_source, @valid_destination, 'format' => 'cc'
36
+ assert_equal Moodle2CC::CC::Converter, migrator.instance_variable_get(:@converter_class)
37
+ end
38
+
39
+ def test_it_allows_canvas_format
40
+ migrator = Moodle2CC::Migrator.new @valid_source, @valid_destination, 'format' => 'canvas'
41
+ assert_equal Moodle2CC::Canvas::Converter, migrator.instance_variable_get(:@converter_class)
42
+ end
43
+
44
+ def test_it_does_not_allow_any_other_format
45
+ assert_raises Moodle2CC::Error, "'angel' is not a valid format. Please use 'cc' or 'canvas'." do
46
+ Moodle2CC::Migrator.new @valid_source, @valid_destination, 'format' => 'angel'
47
+ end
48
+ end
49
+
50
+ def test_it_converts_moodle_backup
51
+ migrator = Moodle2CC::Migrator.new @valid_source, @valid_destination
52
+ migrator.migrate
53
+ imscc_file = File.join(@valid_destination, "my-course.imscc")
54
+ assert File.exists?(imscc_file), "#{imscc_file} does not exist"
55
+ end
56
+ end
@@ -0,0 +1,30 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMoodleBackup < MiniTest::Unit::TestCase
6
+ include TestHelper
7
+
8
+ def setup
9
+ @moodle_backup_path = create_moodle_backup_zip
10
+ end
11
+
12
+ def teardown
13
+ clean_tmp_folder
14
+ end
15
+
16
+ def test_it_has_info
17
+ backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
18
+ assert_instance_of Moodle2CC::Moodle::Info, backup.info
19
+ end
20
+
21
+ def test_it_has_a_course
22
+ backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
23
+ assert_instance_of Moodle2CC::Moodle::Course, backup.course
24
+ end
25
+
26
+ def test_it_has_files
27
+ backup = Moodle2CC::Moodle::Backup.read @moodle_backup_path
28
+ assert_equal ["folder/test.txt", "test.txt"], backup.files
29
+ end
30
+ end
@@ -0,0 +1,57 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMoodleCourse < 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
+ end
13
+
14
+ def teardown
15
+ clean_tmp_folder
16
+ end
17
+
18
+ def test_it_has_an_id
19
+ assert_equal 55555, @course.id
20
+ end
21
+
22
+ def test_it_has_a_fullname
23
+ assert_equal "My Course", @course.fullname
24
+ end
25
+
26
+ def test_it_has_a_shortname
27
+ assert_equal "EDU 101", @course.shortname
28
+ end
29
+
30
+ def test_it_has_a_startdate
31
+ assert_equal 1339390800, @course.startdate
32
+ end
33
+
34
+ def test_it_has_a_format
35
+ assert_equal 'weeks', @course.format
36
+ end
37
+
38
+ def test_it_has_a_visibility
39
+ assert_equal true, @course.visible
40
+ end
41
+
42
+ def test_it_has_sections
43
+ assert @course.sections.length > 0
44
+ end
45
+
46
+ def test_it_has_modules
47
+ assert @course.mods.length > 0
48
+ end
49
+
50
+ def test_it_has_grade_items
51
+ assert @course.grade_items.length > 0
52
+ end
53
+
54
+ def test_it_has_question_categories
55
+ assert @course.question_categories.length > 0
56
+ end
57
+ end
@@ -0,0 +1,72 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMoodleGradeItem < 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
+ @grade_items = @course.grade_items
13
+ @grade_item = @grade_items.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, @grade_item.course
22
+ end
23
+
24
+ def test_it_has_an_instance
25
+ mod = @course.mods.find { |mod| mod.id == 987 }
26
+ assert_equal @grade_item.instance, mod
27
+ end
28
+
29
+ def test_it_has_an_id
30
+ assert_equal 71717, @grade_item.id
31
+ end
32
+
33
+ def test_it_has_a_category_id
34
+ assert_equal 17171, @grade_item.category_id
35
+ end
36
+
37
+ def test_it_has_an_item_name
38
+ assert_equal 'My First Grade Item', @grade_item.item_name
39
+ end
40
+
41
+ def test_it_has_an_item_type
42
+ assert_equal 'mod', @grade_item.item_type
43
+ end
44
+
45
+ def test_it_has_an_item_module
46
+ assert_equal 'assignment', @grade_item.item_module
47
+ end
48
+
49
+ def test_it_has_an_item_instance
50
+ assert_equal 987, @grade_item.item_instance
51
+ end
52
+
53
+ def test_it_has_an_item_number
54
+ assert_equal 0, @grade_item.item_number
55
+ end
56
+
57
+ def test_it_has_a_grade_type
58
+ assert_equal 2, @grade_item.grade_type
59
+ end
60
+
61
+ def test_it_has_a_grade_max
62
+ assert_equal 150.0, @grade_item.grade_max
63
+ end
64
+
65
+ def test_it_has_a_grade_min
66
+ assert_equal 1.0, @grade_item.grade_min
67
+ end
68
+
69
+ def test_it_has_a_scale_id
70
+ assert_equal 8, @grade_item.scale_id
71
+ end
72
+ end
@@ -0,0 +1,21 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMoodleInfo < 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
+ @info = @backup.info
12
+ end
13
+
14
+ def teardown
15
+ clean_tmp_folder
16
+ end
17
+
18
+ def test_it_has_a_name
19
+ assert_equal "moodle_backup.zip", @info.name
20
+ end
21
+ end
@@ -0,0 +1,301 @@
1
+ require 'minitest/autorun'
2
+ require 'test/test_helper'
3
+ require 'moodle2cc'
4
+
5
+ class TestUnitMoodleMod < 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
+ @mods = @course.mods
13
+ @quiz_mod = @mods.find { |mod| mod.mod_type == 'quiz' }
14
+ @questionnaire_mod = @mods.find { |mod| mod.mod_type == 'questionnaire' }
15
+ @choice_mod = @mods.find { |mod| mod.mod_type == 'choice' }
16
+ @wiki_mod = @mods.find { |mod| mod.mod_type == 'wiki' }
17
+ @workshop_mod = @mods.find { |mod| mod.mod_type == 'workshop' }
18
+ @question_instance = @quiz_mod.question_instances.first
19
+ @question = @course.question_categories.first.questions.first
20
+ end
21
+
22
+ def teardown
23
+ clean_tmp_folder
24
+ end
25
+
26
+ def test_it_has_all_the_mods
27
+ assert_equal 11, @mods.length
28
+ end
29
+
30
+ def test_it_has_an_id
31
+ assert_equal 987, @mods[0].id
32
+ end
33
+
34
+ def test_it_has_an_var1
35
+ assert_equal 0, @mods[0].var1
36
+ end
37
+
38
+ def test_it_has_an_var2
39
+ assert_equal 1, @mods[0].var2
40
+ end
41
+
42
+ def test_it_has_an_var3
43
+ assert_equal 2, @mods[0].var3
44
+ end
45
+
46
+ def test_it_has_an_var4
47
+ assert_equal 3, @mods[0].var4
48
+ end
49
+
50
+ def test_it_has_an_var5
51
+ assert_equal 4, @mods[0].var5
52
+ end
53
+
54
+ def test_it_has_a_mod_type
55
+ assert_equal "assignment", @mods[0].mod_type
56
+ end
57
+
58
+ def test_it_has_a_type
59
+ assert_equal "file", @mods[1].type
60
+ end
61
+
62
+ def test_it_has_a_name
63
+ assert_equal "Create a Rails site", @mods[0].name
64
+ end
65
+
66
+ def test_it_has_a_description
67
+ assert_equal "<h1>Hello World</h1>", @mods[0].description
68
+ end
69
+
70
+ def test_it_has_a_summary
71
+ assert_equal 'This is my wiki. There are many like it, but this one is mine.', @wiki_mod.summary
72
+ end
73
+
74
+ def test_it_has_content
75
+ assert_equal "Section 1", @mods[3].content
76
+ end
77
+
78
+ def test_it_has_an_assignment_type
79
+ assert_equal "offline", @mods[0].assignment_type
80
+ end
81
+
82
+ def test_it_has_a_resubmit
83
+ assert_equal false, @mods[0].resubmit
84
+ end
85
+
86
+ def test_it_has_a_prevent_late
87
+ assert_equal true, @mods[0].prevent_late
88
+ end
89
+
90
+ def test_it_has_a_grade
91
+ assert_equal 5, @mods[0].grade
92
+ end
93
+
94
+ def test_it_has_number_of_attachments
95
+ assert_equal 0, @workshop_mod.number_of_attachments
96
+ end
97
+
98
+ def test_it_has_number_of_student_assessments
99
+ assert_equal 5, @workshop_mod.number_of_student_assessments
100
+ end
101
+
102
+ def test_it_has_anonymous
103
+ assert_equal false, @workshop_mod.anonymous
104
+ end
105
+
106
+ def test_it_has_submission_start
107
+ assert_equal 1342117800, @workshop_mod.submission_start
108
+ end
109
+
110
+ def test_it_has_submission_end
111
+ assert_equal 1342722600, @workshop_mod.submission_end
112
+ end
113
+
114
+ def test_it_has_assessment_start
115
+ assert_equal 1342119000, @workshop_mod.assessment_start
116
+ end
117
+
118
+ def test_it_has_assessment_end
119
+ assert_equal 1342724000, @workshop_mod.assessment_end
120
+ end
121
+
122
+ def test_it_has_a_time_due
123
+ assert_equal 1355356740, @mods[0].time_due
124
+ end
125
+
126
+ def test_it_has_a_time_available
127
+ assert_equal 1355314332, @mods[0].time_available
128
+ end
129
+
130
+ def test_it_has_a_reference
131
+ assert_equal "http://en.wikipedia.org/wiki/Einstein", @mods[1].reference
132
+ end
133
+
134
+ def test_it_has_an_intro
135
+ assert_equal "General news and announcements", @mods[2].intro
136
+ end
137
+
138
+ def test_it_has_alltext
139
+ assert_equal "<p><strong> Instructor Resources </strong></p>", @mods[4].alltext
140
+ end
141
+
142
+ def test_it_has_text
143
+ assert_equal "Which one will you choose?", @choice_mod.text
144
+ end
145
+
146
+ def test_it_has_time_open
147
+ assert_equal 1339440600, @quiz_mod.time_open
148
+ end
149
+
150
+ def test_it_has_time_close
151
+ assert_equal 1339527000, @quiz_mod.time_close
152
+ end
153
+
154
+ def test_it_has_a_time_limit
155
+ assert_equal 45, @quiz_mod.time_limit
156
+ end
157
+
158
+ def test_it_has_attempts_number
159
+ assert_equal 2, @quiz_mod.attempts_number
160
+ end
161
+
162
+ def test_it_has_a_grade_method
163
+ assert_equal 1, @quiz_mod.grade_method
164
+ end
165
+
166
+ def test_it_has_a_password
167
+ assert_equal 'password', @quiz_mod.password
168
+ end
169
+
170
+ def test_it_has_a_subnet
171
+ assert_equal '127.0.0.1', @quiz_mod.subnet
172
+ end
173
+
174
+ def test_it_has_shuffle_answers
175
+ assert_equal true, @quiz_mod.shuffle_answers
176
+ end
177
+
178
+ def test_it_has_a_page_name
179
+ assert_equal 'My Wiki', @wiki_mod.page_name
180
+ end
181
+
182
+ def test_it_has_pages
183
+ assert @wiki_mod.pages.length > 0, 'wiki mod does not have pages'
184
+ end
185
+
186
+ def test_page_has_a_page_name
187
+ page = @wiki_mod.pages.first
188
+ assert 'My Wiki', page.page_name
189
+ end
190
+
191
+ def test_page_has_a_version
192
+ page = @wiki_mod.pages.first
193
+ assert 1, page.version
194
+ end
195
+
196
+ def test_page_has_content
197
+ page = @wiki_mod.pages.first
198
+ assert 'This is the content for the first version of the first page', page.content
199
+ end
200
+
201
+ def test_it_has_questionnaire_questions
202
+ assert @questionnaire_mod.questions.length > 0, 'questionnaire mod does not have questions'
203
+ end
204
+
205
+ def test_questionnaire_questions_are_in_order
206
+ question1 = @questionnaire_mod.questions.first
207
+ assert_equal 'Have you ever been experienced?', question1.content
208
+ assert_equal 1, question1.position
209
+ question2 = @questionnaire_mod.questions.last
210
+ assert_equal 'Are you experienced?', question2.content
211
+ assert_equal 2, question2.position
212
+ end
213
+
214
+ def test_it_has_options
215
+ assert @choice_mod.options.length > 0, 'mod does not have options'
216
+ end
217
+
218
+ def test_options_have_an_id
219
+ assert_equal 15, @choice_mod.options.first.id
220
+ end
221
+
222
+ def test_options_have_text
223
+ assert_equal 'choice1', @choice_mod.options.first.text
224
+ end
225
+
226
+ def test_it_has_a_choice_question
227
+ assert_equal 1, @choice_mod.questions.length
228
+ end
229
+
230
+ def test_choice_question_has_an_id
231
+ assert_equal "choice_question_110", @choice_mod.questions.first.id
232
+ end
233
+
234
+ def test_choice_question_has_a_name
235
+ assert_equal "My Choice", @choice_mod.questions.first.name
236
+ end
237
+
238
+ def test_choice_question_has_text
239
+ assert_equal "Which one will you choose?", @choice_mod.questions.first.text
240
+ end
241
+
242
+ def test_choice_question_has_a_grade
243
+ assert_equal 1, @choice_mod.questions.first.grade
244
+ end
245
+
246
+ def test_choice_question_has_a_type
247
+ assert_equal 'choice', @choice_mod.questions.first.type
248
+ end
249
+
250
+ def test_choice_question_has_answers
251
+ assert @choice_mod.questions.first.answers.length > 0, 'choice question does not have answers'
252
+ end
253
+
254
+ def test_choice_question_answers_have_an_id
255
+ assert_equal 15, @choice_mod.questions.first.answers.first.id
256
+ end
257
+
258
+ def test_choice_question_answers_have_test
259
+ assert_equal 'choice1', @choice_mod.questions.first.answers.first.text
260
+ end
261
+
262
+ def test_it_has_question_instances
263
+ assert @quiz_mod.question_instances.length > 0, 'quiz mod does not have question_instances'
264
+ end
265
+
266
+ def test_it_has_quiz_questions_from_question_instances
267
+ assert @quiz_mod.questions.length == @quiz_mod.question_instances.length, 'quiz mod does not have questions for each question instance'
268
+ assert_equal @quiz_mod.questions.first.grade, @quiz_mod.question_instances.first.grade
269
+ assert_equal @quiz_mod.questions.first.instance_id, @quiz_mod.question_instances.first.id
270
+ end
271
+
272
+ def test_question_instance_has_an_id
273
+ assert_equal 697, @question_instance.id
274
+ end
275
+
276
+ def test_question_instance_has_a_question_id
277
+ assert_equal 989, @question_instance.question_id
278
+ end
279
+
280
+ def test_question_instance_has_a_grade
281
+ assert_equal 1, @question_instance.grade
282
+ end
283
+
284
+ def test_question_instance_has_a_mod
285
+ assert_equal @quiz_mod, @question_instance.mod
286
+ end
287
+
288
+ def test_question_instance_has_a_question
289
+ assert_equal @question, @question_instance.question
290
+ end
291
+
292
+ def test_it_has_section_mods
293
+ assert_equal @course.sections.first.mods.first, @mods[0].section_mod
294
+ end
295
+
296
+ def test_it_has_a_grade_item
297
+ mod = @mods.find { |m| m.id == 987 }
298
+ grade_item = @course.grade_items.find { |g| g.item_instance == mod.id }
299
+ assert_equal grade_item, mod.grade_item
300
+ end
301
+ end