sambal-cle 0.1.3 → 0.1.4
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.
- data/README.md +3 -1
- data/lib/sambal-cle/base_page.rb +3 -1
- data/lib/sambal-cle/data_objects/announcement.rb +7 -10
- data/lib/sambal-cle/data_objects/assessment.rb +265 -9
- data/lib/sambal-cle/data_objects/assignment.rb +38 -32
- data/lib/sambal-cle/data_objects/assignment_permissions.rb +61 -0
- data/lib/sambal-cle/data_objects/assignment_submission.rb +126 -0
- data/lib/sambal-cle/data_objects/blog.rb +4 -7
- data/lib/sambal-cle/data_objects/blogger.rb +4 -10
- data/lib/sambal-cle/data_objects/chat_room.rb +5 -8
- data/lib/sambal-cle/data_objects/event.rb +6 -17
- data/lib/sambal-cle/data_objects/forum.rb +9 -19
- data/lib/sambal-cle/data_objects/lesson.rb +8 -29
- data/lib/sambal-cle/data_objects/message.rb +7 -10
- data/lib/sambal-cle/data_objects/poll.rb +6 -11
- data/lib/sambal-cle/data_objects/resource.rb +28 -37
- data/lib/sambal-cle/data_objects/site.rb +6 -17
- data/lib/sambal-cle/data_objects/syllabus.rb +6 -8
- data/lib/sambal-cle/data_objects/user.rb +88 -0
- data/lib/sambal-cle/data_objects/web_content_tool.rb +5 -6
- data/lib/sambal-cle/data_objects/wiki.rb +6 -6
- data/lib/sambal-cle/page_objects/account.rb +0 -2
- data/lib/sambal-cle/page_objects/announcements.rb +0 -1
- data/lib/sambal-cle/page_objects/assessments.rb +57 -87
- data/lib/sambal-cle/page_objects/assignments.rb +117 -337
- data/lib/sambal-cle/page_objects/calendar.rb +0 -2
- data/lib/sambal-cle/page_objects/login.rb +3 -9
- data/lib/sambal-cle/page_objects/sections.rb +2 -3
- data/lib/sambal-cle/page_objects/site_setup.rb +9 -19
- data/lib/sambal-cle/rich_text.rb +6 -0
- data/lib/sambal-cle/utilities.rb +4 -10
- data/lib/sambal-cle/workflows.rb +1 -5
- data/lib/sambal-cle.rb +2 -10
- data/sambal-cle.gemspec +7 -8
- data/test/add_assignment_to_calendar_spec.rb +14 -15
- data/test/assessment_create_spec.rb +355 -0
- data/test/assignment_announcements_spec.rb +14 -15
- data/test/assignment_duplicate_spec.rb +56 -0
- data/test/assignment_gradebook_spec.rb +16 -15
- data/test/assignment_permissions_spec.rb +77 -0
- data/test/assignments_grading_spec.rb +123 -0
- data/test/assignments_submission_spec.rb +143 -0
- data/test/config.yml +3 -0
- data/test/directory.yml +120 -0
- data/test/duplicate_site_spec.rb +5 -3
- data/test/import_site_content_spec.rb +248 -0
- metadata +22 -31
- data/lib/sambal-cle/core-ext.rb +0 -90
- data/lib/sambal-cle/date_makers.rb +0 -118
- data/lib/sambal-cle/gem_ext.rb +0 -23
- data/lib/sambal-cle/page_helper.rb +0 -22
- data/lib/sambal-cle/page_maker.rb +0 -48
- data/lib/sambal-cle/randomizers.rb +0 -117
@@ -0,0 +1,355 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'sambal-cle'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
describe "Assessments" do
|
6
|
+
|
7
|
+
include Utilities
|
8
|
+
include Workflows
|
9
|
+
include Foundry
|
10
|
+
include StringFactory
|
11
|
+
include DateFactory
|
12
|
+
|
13
|
+
before :all do
|
14
|
+
# Get the test configuration data
|
15
|
+
@config = YAML.load_file("config.yml")
|
16
|
+
@directory = YAML.load_file("directory.yml")
|
17
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
18
|
+
@browser = @sakai.browser
|
19
|
+
|
20
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
21
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
22
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
23
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
24
|
+
:type=>"Instructor"
|
25
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
26
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
27
|
+
:type=>"Instructor"
|
28
|
+
@instructor1.log_in
|
29
|
+
|
30
|
+
@site = make SiteObject
|
31
|
+
@site.create
|
32
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
33
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
34
|
+
|
35
|
+
@assessment = make AssessmentObject, :site=>@site.name
|
36
|
+
@assessment.create
|
37
|
+
|
38
|
+
@assessment.add_part
|
39
|
+
@assessment.add_part
|
40
|
+
@assessment.add_question
|
41
|
+
exit
|
42
|
+
|
43
|
+
@questions = [
|
44
|
+
{:type=>"Multiple Choice", :point_value=>"5", :question_text=>"Who was the first US president?", :a=>"Jefferson", :b=>"Lincoln", :c=>"Grant", :d=>"Washington" },
|
45
|
+
{:type=>"True False", :point_value=>"5", :question_text=>"The sky is blue."},
|
46
|
+
{:type=>"Fill in the Blank", :point_value=>"5", :question_text=>"The largest state in the US according to land mass is {Alaska}." },
|
47
|
+
{:type=>"Survey", :question_text=>"Do you find this CLE instance usable?" },
|
48
|
+
{:type=>"Short Answer/Essay", :point_value=>"5", :question_text=>"Write an essay about something." },
|
49
|
+
{:type=>"Fill in the Blank", :point_value=>"5", :question_text=>"After Queen Anne's War, French residents of Acadia were given one year to declare allegiance to {Britain} or leave {Nova Scotia}." },
|
50
|
+
{:type=>"Matching", :point_value=>"5", :question_text=>"This is a matching question", :choice_one=>"1", :match_one=>"one", :choice_two=>"2", :match_two=>"two" },
|
51
|
+
{:type=>"True False", :point_value=>"5", :question_text=>"Epistemology is the study of rocks." },
|
52
|
+
{:type=>"File Upload", :point_value=>"5", :question_text=>"Upload a file..." },
|
53
|
+
{:type=>"Fill in the Blank", :point_value=>"5", :question_text=>"Roses are {red} and violets are {blue}." },
|
54
|
+
{:type=>"Multiple Choice", :point_value=>"5", :question_text=>"How many licks does it take to get to the center of a Tootsie Roll Pop?", :a=>"3", :b=>"20", :c=>"500", :d=>"10,000" },
|
55
|
+
{:type=>"True False", :point_value=>"10", :question_text=>"The United States of America is in the Northern hemisphere." },
|
56
|
+
{:type=>"True False", :question_text=>"Birds can fly." }
|
57
|
+
]
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
@questions.each do |question|
|
63
|
+
@assessment.add_question question
|
64
|
+
end
|
65
|
+
|
66
|
+
@part_2_title = "This is Part 2"
|
67
|
+
@part_2_info = "This is the information for Part 2"
|
68
|
+
|
69
|
+
@settings = {
|
70
|
+
:available_date=>((Time.now - 60).strftime("%m/%d/%Y %I:%M:%S %p")),
|
71
|
+
:due_date=>((Time.now + (86400*3)).strftime("%m/%d/%Y %I:%M:%S %p")),
|
72
|
+
:retract_date=>((Time.now + (86400*3)).strftime("%m/%d/%Y %I:%M:%S %p"))
|
73
|
+
}
|
74
|
+
@file_path = @config['data_directory']
|
75
|
+
@pool_title = random_alphanums
|
76
|
+
@pool_description = "Sample Question Pool"
|
77
|
+
@pool_file = "documents/Exam1.xml"
|
78
|
+
@imported_pool_name = "Exam 1"
|
79
|
+
|
80
|
+
# Store the quiz titles in the directory.yml for later use
|
81
|
+
@directory['site1']['quiz1'] = @assessments[0][:title]
|
82
|
+
@directory['site1']['quiz2'] = @assessments[1][:title]
|
83
|
+
|
84
|
+
# Validation text -- These contain page content that will be used for
|
85
|
+
# test asserts.
|
86
|
+
@due_date = "There is no due date for this assessment."
|
87
|
+
@time_limit = "There is no time limit."
|
88
|
+
@submission_limit = "You can submit this assessment an unlimited number of times. Your highest score will be recorded."
|
89
|
+
@feedback_policy = "No feedback will be provided."
|
90
|
+
end
|
91
|
+
|
92
|
+
after :all do
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
it "Does stuff" do
|
97
|
+
|
98
|
+
|
99
|
+
# Select multiple choice question type
|
100
|
+
question1 = quiz.select_question_type @questions[0][:type]
|
101
|
+
|
102
|
+
# Set up the question info...
|
103
|
+
question1.answer_point_value=@questions[0][:point_value]
|
104
|
+
question1.question_text=@questions[0][:question_text]
|
105
|
+
question1.answer_a=@questions[0][:a]
|
106
|
+
question1.answer_b=@questions[0][:b]
|
107
|
+
question1.answer_c=@questions[0][:c]
|
108
|
+
question1.answer_d=@questions[0][:d]
|
109
|
+
question1.select_d_correct
|
110
|
+
|
111
|
+
# Save the question
|
112
|
+
quiz = question1.save
|
113
|
+
|
114
|
+
# TEST CASE: Verify the question appears on the Edit Assessment page
|
115
|
+
assert @browser.frame(:index=>1).select(:id=>"assesssmentForm:parts:0:parts:0:number").exist?
|
116
|
+
assert_not_equal false, quiz.get_question_text(1, 1)=~/#{Regexp.escape(@questions[0][:question_text])}/
|
117
|
+
|
118
|
+
# Add a True/False question
|
119
|
+
question2 = quiz.select_question_type @questions[1][:type]
|
120
|
+
|
121
|
+
question2.answer_point_value=@questions[1][:point_value]
|
122
|
+
question2.question_text=@questions[1][:question_text]
|
123
|
+
question2.select_answer_true
|
124
|
+
quiz = question2.save
|
125
|
+
|
126
|
+
# TEST CASE: Verify the question appears
|
127
|
+
assert @browser.frame(:index=>1).select(:id=>"assesssmentForm:parts:0:parts:1:number").exist?
|
128
|
+
|
129
|
+
# Select fill-in-the-blank question type
|
130
|
+
question3 = quiz.select_question_type @questions[2][:type]
|
131
|
+
|
132
|
+
question3.answer_point_value=@questions[2][:point_value]
|
133
|
+
question3.question_text=@questions[2][:question_text]
|
134
|
+
quiz = question3.save
|
135
|
+
|
136
|
+
# Preview the assessment
|
137
|
+
overview = quiz.preview
|
138
|
+
|
139
|
+
#TEST CASE: Verify the preview overview contents
|
140
|
+
assert_equal(@due_date, overview.due_date)
|
141
|
+
assert_equal(@time_limit, overview.time_limit)
|
142
|
+
assert_equal(@submission_limit, overview.submission_limit)
|
143
|
+
assert_equal(@feedback_policy, overview.feedback)
|
144
|
+
|
145
|
+
quiz = overview.done
|
146
|
+
|
147
|
+
# Add a Survey question
|
148
|
+
question4 = quiz.select_question_type @questions[3][:type]
|
149
|
+
|
150
|
+
question4.question_text=@questions[3][:question_text]
|
151
|
+
question4.select_below_above
|
152
|
+
quiz = question4.save
|
153
|
+
|
154
|
+
# Select Short Answer question type
|
155
|
+
question5 = quiz.select_question_type @questions[4][:type]
|
156
|
+
|
157
|
+
question5.answer_point_value=@questions[4][:point_value]
|
158
|
+
question5.question_text=@questions[4][:question_text]
|
159
|
+
quiz = question5.save
|
160
|
+
|
161
|
+
# Add another fill-in-the-blank question
|
162
|
+
question6 = quiz.select_question_type @questions[5][:type]
|
163
|
+
|
164
|
+
question6.question_text=@questions[5][:question_text]
|
165
|
+
question6.answer_point_value=@questions[5][:point_value]
|
166
|
+
quiz = question6.save
|
167
|
+
|
168
|
+
# Select a Matching question type
|
169
|
+
question7 = quiz.select_question_type @questions[6][:type]
|
170
|
+
|
171
|
+
question7.answer_point_value=@questions[6][:point_value]
|
172
|
+
question7.question_text=@questions[6][:question_text]
|
173
|
+
question7.choice=@questions[6][:choice_one]
|
174
|
+
question7.match=@questions[6][:match_one]
|
175
|
+
question7.save_pairing
|
176
|
+
question7.choice=@questions[6][:choice_one]
|
177
|
+
question7.match=@questions[6][:match_one]
|
178
|
+
question7.save_pairing
|
179
|
+
quiz = question7.save
|
180
|
+
|
181
|
+
# Select another True/False question type
|
182
|
+
question8 = quiz.select_question_type @questions[7][:type]
|
183
|
+
|
184
|
+
question8.answer_point_value=@questions[7][:point_value]
|
185
|
+
question8.question_text=@questions[7][:question_text]
|
186
|
+
question8.select_answer_false
|
187
|
+
question8.select_required_rationale_yes
|
188
|
+
quiz = question8.save
|
189
|
+
|
190
|
+
# Add a File Upload question
|
191
|
+
question9 = quiz.select_question_type @questions[8][:type]
|
192
|
+
|
193
|
+
question9.answer_point_value=@questions[8][:point_value]
|
194
|
+
question9.question_text=@questions[8][:question_text]
|
195
|
+
quiz = question9.save
|
196
|
+
|
197
|
+
# Add a part 2 to the assessment
|
198
|
+
part = quiz.add_part
|
199
|
+
|
200
|
+
part.title=@part_2_title
|
201
|
+
part.information=@part_2_info
|
202
|
+
|
203
|
+
quiz = part.save
|
204
|
+
|
205
|
+
# TEST CASE: Verify part 2 appears
|
206
|
+
assert @browser.frame(:index=>1).select(:id=>"assesssmentForm:parts:1:number").exist?
|
207
|
+
|
208
|
+
# Add questions to Part 2
|
209
|
+
question10 = quiz.insert_question_after(2, 0, @questions[9][:type])
|
210
|
+
|
211
|
+
# New fill-in-the-blank question
|
212
|
+
question10.answer_point_value=@questions[9][:point_value]
|
213
|
+
question10.question_text=@questions[9][:question_text]
|
214
|
+
quiz = question10.save
|
215
|
+
|
216
|
+
# Go to the Settings page of the Assessment
|
217
|
+
settings_page = quiz.settings
|
218
|
+
|
219
|
+
settings_page.open
|
220
|
+
# Set assessment dates
|
221
|
+
settings_page.available_date=@settings[:available_date]
|
222
|
+
settings_page.due_date=@settings[:due_date]
|
223
|
+
settings_page.retract_date=@settings[:retract_date]
|
224
|
+
|
225
|
+
# Set feedback options
|
226
|
+
settings_page.select_immediate_feedback
|
227
|
+
settings_page.select_both_feedback_levels
|
228
|
+
settings_page.select_release_questions_and
|
229
|
+
settings_page.check_release_student_response
|
230
|
+
settings_page.check_release_correct_response
|
231
|
+
settings_page.check_release_students_assessment_scores
|
232
|
+
settings_page.check_release_students_question_and_part_scores
|
233
|
+
settings_page.check_release_question_level_feedback
|
234
|
+
settings_page.check_release_selection_level_feedback
|
235
|
+
settings_page.check_release_graders_comments
|
236
|
+
settings_page.check_release_statistics
|
237
|
+
|
238
|
+
# Set Grading options
|
239
|
+
settings_page.select_student_ids_seen
|
240
|
+
|
241
|
+
# Set only one submission allowed
|
242
|
+
settings_page.select_only_x_submissions
|
243
|
+
settings_page.allowed_submissions="1"
|
244
|
+
|
245
|
+
# Save and publish the assessment
|
246
|
+
assessment = settings_page.save_and_publish
|
247
|
+
list_page = assessment.publish
|
248
|
+
|
249
|
+
# TEST CASE: Verify the assessment is published
|
250
|
+
assert list_page.published_assessment_titles.include?(@assessments[0][:title]), "Can't find #{@assessments[0][:title]} in published list: #{list_page.published_assessment_titles}"
|
251
|
+
|
252
|
+
# Create a Question Pool
|
253
|
+
pools_list = list_page.question_pools
|
254
|
+
new_pool = pools_list.add_new_pool
|
255
|
+
|
256
|
+
new_pool.pool_name=@pool_title
|
257
|
+
new_pool.description=@pool_description
|
258
|
+
pools_list = new_pool.save
|
259
|
+
|
260
|
+
# TEST CASE: the new pool saved properly
|
261
|
+
assert @browser.frame(:index=>1).link(:text=>@pool_title).exist?
|
262
|
+
|
263
|
+
# Open the Pool to add questions
|
264
|
+
pool = pools_list.edit_pool(@pool_title)
|
265
|
+
|
266
|
+
# Add a multiple choice question
|
267
|
+
select_qt = pool.add_question
|
268
|
+
|
269
|
+
mc_question = select_qt.select_question_type @questions[10][:type]
|
270
|
+
|
271
|
+
mc_question.answer_point_value=@questions[10][:point_value]
|
272
|
+
mc_question.question_text=@questions[10][:question_text]
|
273
|
+
mc_question.answer_a=@questions[10][:a]
|
274
|
+
mc_question.answer_b=@questions[10][:b]
|
275
|
+
mc_question.answer_c=@questions[10][:c]
|
276
|
+
mc_question.answer_d=@questions[10][:d]
|
277
|
+
mc_question.select_a_correct
|
278
|
+
pool = mc_question.save
|
279
|
+
|
280
|
+
# TEST CASE: The new question saved properly
|
281
|
+
assert @browser.frame(:index=>1).link(:text=>@questions[10][:question_text]).exist?
|
282
|
+
|
283
|
+
# Add a True/False question
|
284
|
+
select_qt = pool.add_question
|
285
|
+
|
286
|
+
tfq = select_qt.select_question_type @questions[11][:type]
|
287
|
+
tfq.answer_point_value=@questions[11][:point_value]
|
288
|
+
tfq.question_text=@questions[11][:question_text]
|
289
|
+
tfq.select_answer_true
|
290
|
+
tfq.select_required_rationale_yes
|
291
|
+
pool = tfq.save
|
292
|
+
|
293
|
+
pools_list = pool.question_pools
|
294
|
+
# Import a Question Pool
|
295
|
+
import_page = pools_list.import
|
296
|
+
import_page.choose_file(@pool_file, @file_path)
|
297
|
+
|
298
|
+
pools_list = import_page.import
|
299
|
+
|
300
|
+
# TEST CASE: Verify import worked
|
301
|
+
assert @browser.frame(:index=>1).span(:text=>@imported_pool_name).exist?
|
302
|
+
|
303
|
+
# Go to the Assessments page
|
304
|
+
assessments = pools_list.assessments
|
305
|
+
|
306
|
+
# Create a new Assessment
|
307
|
+
assessments.title=@assessments[1][:title]
|
308
|
+
quiz2 = assessments.create
|
309
|
+
|
310
|
+
# Add a multiple-choice question
|
311
|
+
mcq = quiz2.select_question_type @questions[0][:type]
|
312
|
+
mcq.answer_point_value=@questions[0][:point_value]
|
313
|
+
mcq.question_text=@questions[0][:question_text]
|
314
|
+
mcq.answer_a=@questions[0][:a]
|
315
|
+
mcq.answer_b=@questions[0][:b]
|
316
|
+
mcq.answer_c=@questions[0][:c]
|
317
|
+
mcq.answer_d=@questions[0][:d]
|
318
|
+
mcq.select_d_correct
|
319
|
+
mcq.select_randomize_answers_yes
|
320
|
+
|
321
|
+
quiz2 = mcq.save
|
322
|
+
|
323
|
+
# TEST CASE: Verify question saved...
|
324
|
+
assert @browser.frame(:index=>1).select(:id=>"assesssmentForm:parts:0:parts:0:number").exist?
|
325
|
+
assert_not_equal false, quiz2.get_question_text(1, 1)=~/#{Regexp.escape(@questions[0][:question_text])}/
|
326
|
+
|
327
|
+
# Add a True/False question
|
328
|
+
q2 = quiz2.select_question_type @questions[12][:type]
|
329
|
+
q2.question_text=@questions[12][:question_text]
|
330
|
+
q2.select_answer_true
|
331
|
+
|
332
|
+
quiz2 = q2.save
|
333
|
+
|
334
|
+
# TEST CASE: Verify the question saved...
|
335
|
+
assert_not_equal false, quiz2.get_question_text(1, 2)=~/#{Regexp.escape(@questions[12][:question_text])}/
|
336
|
+
|
337
|
+
settings_page = quiz2.settings
|
338
|
+
settings_page.open
|
339
|
+
settings_page.select_student_ids_seen
|
340
|
+
settings_page.available_date=@settings[:available_date]
|
341
|
+
settings_page.due_date=@settings[:due_date]
|
342
|
+
settings_page.retract_date=@settings[:retract_date]
|
343
|
+
settings_page.select_only_x_submissions
|
344
|
+
settings_page.allowed_submissions="1"
|
345
|
+
assessment = settings_page.save_and_publish
|
346
|
+
list_page = assessment.publish
|
347
|
+
|
348
|
+
# TEST CASE: Verify assessment published
|
349
|
+
assert list_page.published_assessment_titles.include?(@assessments[1][:title]), "Can't find #{@assessments[1][:title]} in published list: #{list_page.published_assessment_titles}"
|
350
|
+
|
351
|
+
|
352
|
+
end
|
353
|
+
|
354
|
+
|
355
|
+
end
|
@@ -6,9 +6,9 @@ describe "Assignments appearing in Announcements" do
|
|
6
6
|
|
7
7
|
include Utilities
|
8
8
|
include Workflows
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
9
|
+
include Foundry
|
10
|
+
include StringFactory
|
11
|
+
include DateFactory
|
12
12
|
|
13
13
|
before :all do
|
14
14
|
|
@@ -18,21 +18,20 @@ describe "Assignments appearing in Announcements" do
|
|
18
18
|
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
19
19
|
@browser = @sakai.browser
|
20
20
|
|
21
|
-
@student =
|
22
|
-
|
23
|
-
@instructor1 =
|
24
|
-
|
25
|
-
|
26
|
-
@instructor2 =
|
27
|
-
|
28
|
-
|
29
|
-
@
|
21
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
22
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
23
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
24
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
25
|
+
:type=>"Instructor"
|
26
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
27
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
28
|
+
:type=>"Instructor"
|
29
|
+
@instructor1.log_in
|
30
30
|
|
31
31
|
@site = make SiteObject
|
32
32
|
@site.create
|
33
|
-
|
34
|
-
@site.add_official_participants :role
|
35
|
-
@site.add_official_participants :role=>"Instructor", :participants=>[@instructor2]
|
33
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
34
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
36
35
|
|
37
36
|
@assignment1 = make AssignmentObject, :status=>"Draft", :add_open_announcement=>:set, :site=>@site.name, :title=>random_xss_string(30), :open=>in_an_hour, :student_submissions=>"Attachments only", :grade_scale=>"Points", :max_points=>"100", :instructions=>random_multiline(600, 12, :string)
|
38
37
|
@assignment2 = make AssignmentObject, :site=>@site.name, :add_open_announcement=>:set, :open=>an_hour_ago
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'sambal-cle'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
describe "Duplicating an Assignment" do
|
6
|
+
|
7
|
+
include Utilities
|
8
|
+
include Workflows
|
9
|
+
include Foundry
|
10
|
+
include StringFactory
|
11
|
+
include DateFactory
|
12
|
+
|
13
|
+
before :all do
|
14
|
+
|
15
|
+
# Get the test configuration data
|
16
|
+
@config = YAML.load_file("config.yml")
|
17
|
+
@directory = YAML.load_file("directory.yml")
|
18
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
19
|
+
@browser = @sakai.browser
|
20
|
+
|
21
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
22
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
23
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
24
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
25
|
+
:type=>"Instructor"
|
26
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
27
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
28
|
+
:type=>"Instructor"
|
29
|
+
@instructor1.log_in
|
30
|
+
|
31
|
+
@site = make SiteObject
|
32
|
+
@site.create
|
33
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
34
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
35
|
+
|
36
|
+
@assignment = make AssignmentObject, :site=>@site.name, :title=>random_string(25), :open=>next_monday, :grade_scale=>"Pass", :instructions=>random_alphanums
|
37
|
+
|
38
|
+
@assignment.create
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
after :all do
|
43
|
+
# Close the browser window
|
44
|
+
@sakai.browser.close
|
45
|
+
end
|
46
|
+
|
47
|
+
it "Duplicate command creates duplicate of the Assignment" do
|
48
|
+
dupe = @assignment.duplicate
|
49
|
+
on AssignmentsList do |list|
|
50
|
+
list.assignments_titles.should include dupe.title
|
51
|
+
end
|
52
|
+
|
53
|
+
# TODO: Add more verification stuff here
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -6,9 +6,9 @@ describe "Assignments" do
|
|
6
6
|
|
7
7
|
include Utilities
|
8
8
|
include Workflows
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
9
|
+
include Foundry
|
10
|
+
include StringFactory
|
11
|
+
include DateFactory
|
12
12
|
|
13
13
|
before :all do
|
14
14
|
|
@@ -18,21 +18,20 @@ describe "Assignments" do
|
|
18
18
|
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
19
19
|
@browser = @sakai.browser
|
20
20
|
|
21
|
-
@student =
|
22
|
-
|
23
|
-
@instructor1 =
|
24
|
-
|
25
|
-
|
26
|
-
@instructor2 =
|
27
|
-
|
28
|
-
|
29
|
-
@
|
21
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
22
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
23
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
24
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
25
|
+
:type=>"Instructor"
|
26
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
27
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
28
|
+
:type=>"Instructor"
|
29
|
+
@instructor1.log_in
|
30
30
|
|
31
31
|
@site = make SiteObject
|
32
32
|
@site.create
|
33
|
-
|
34
|
-
@site.add_official_participants :role
|
35
|
-
@site.add_official_participants :role=>"Instructor", :participants=>[@instructor2]
|
33
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
34
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
36
35
|
|
37
36
|
@assignment = make AssignmentObject, :site=>@site.name, :title=>random_string(25), :open=>next_monday, :grade_scale=>"Pass", :instructions=>random_multiline(300, 15, :string)
|
38
37
|
|
@@ -95,4 +94,6 @@ describe "Assignments" do
|
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
97
|
+
# TODO: Add a GB2 test here.
|
98
|
+
|
98
99
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'sambal-cle'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
# TODO: Add more tests of various permissions settings.
|
6
|
+
|
7
|
+
describe "Assignment Permissions" do
|
8
|
+
|
9
|
+
include Utilities
|
10
|
+
include Workflows
|
11
|
+
include Foundry
|
12
|
+
include StringFactory
|
13
|
+
include DateFactory
|
14
|
+
|
15
|
+
before :all do
|
16
|
+
|
17
|
+
# Get the test configuration data
|
18
|
+
@config = YAML.load_file("config.yml")
|
19
|
+
@directory = YAML.load_file("directory.yml")
|
20
|
+
@sakai = SakaiCLE.new(@config['browser'], @config['url'])
|
21
|
+
@browser = @sakai.browser
|
22
|
+
|
23
|
+
@student = make UserObject, :id=>@directory['person1']['id'], :password=>@directory['person1']['password'],
|
24
|
+
:first_name=>@directory['person1']['firstname'], :last_name=>@directory['person1']['lastname']
|
25
|
+
@instructor1 = make UserObject, :id=>@directory['person3']['id'], :password=>@directory['person3']['password'],
|
26
|
+
:first_name=>@directory['person3']['firstname'], :last_name=>@directory['person3']['lastname'],
|
27
|
+
:type=>"Instructor"
|
28
|
+
@instructor2 = make UserObject, :id=>@directory['person4']['id'], :password=>@directory['person4']['password'],
|
29
|
+
:first_name=>@directory['person4']['firstname'], :last_name=>@directory['person4']['lastname'],
|
30
|
+
:type=>"Instructor"
|
31
|
+
@instructor1.log_in
|
32
|
+
|
33
|
+
@site = make SiteObject
|
34
|
+
@site.create
|
35
|
+
@site.add_official_participants :role=>@student.type, :participants=>[@student.id]
|
36
|
+
@site.add_official_participants :role=>@instructor2.type, :participants=>[@instructor2.id]
|
37
|
+
|
38
|
+
@site = make SiteObject
|
39
|
+
@site.create
|
40
|
+
|
41
|
+
@site.add_official_participants :role=>"Student", :participants=>[@student]
|
42
|
+
@site.add_official_participants :role=>"Instructor", :participants=>[@instructor2]
|
43
|
+
|
44
|
+
@assignment = make AssignmentObject, :status=>"Draft", :site=>@site.name, :title=>random_string(25), :open=>next_monday
|
45
|
+
@assignment2 = make AssignmentObject, :site=>@site.name
|
46
|
+
@assignment.create
|
47
|
+
@assignment2.create
|
48
|
+
|
49
|
+
@permissions = make AssignmentPermissionsObject, :site=>@site.name
|
50
|
+
|
51
|
+
@instructor1.log_out
|
52
|
+
@instructor2.log_in
|
53
|
+
end
|
54
|
+
|
55
|
+
after :all do
|
56
|
+
# Close the browser window
|
57
|
+
@sakai.browser.close
|
58
|
+
end
|
59
|
+
|
60
|
+
it "Default permissions allow instructors to share drafts" do
|
61
|
+
open_my_site_by_name @assignment.site
|
62
|
+
assignments
|
63
|
+
on AssignmentsList do |list|
|
64
|
+
list.assignments_list.should include "Draft - #{@assignment.title}"
|
65
|
+
list.assignments_list.should include @assignment2.title
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "Removing 'share draft' permissions for instructors works as expected" do
|
70
|
+
@permissions.set :instructor=>{:share_drafts=>:clear}
|
71
|
+
on AssignmentsList do |list|
|
72
|
+
list.assignments_list.should_not include "Draft - #{@assignment.title}"
|
73
|
+
list.assignments_list.should include @assignment2.title
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|