quiz_api_client 4.2.1 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -48
- data/Rakefile +0 -29
- data/lib/quiz_api_client/services/courses_service.rb +37 -0
- data/lib/quiz_api_client/services/quiz_clone_jobs_service.rb +11 -0
- data/lib/quiz_api_client/services/quiz_sync_job_service.rb +17 -0
- data/lib/quiz_api_client/services/quiz_sync_jobs_service.rb +16 -0
- data/lib/quiz_api_client/version.rb +1 -1
- data/lib/quiz_api_client.rb +15 -0
- data/spec/quiz_api_client_spec.rb +7 -0
- data/spec/services/courses_service_spec.rb +98 -0
- data/spec/services/quiz_clone_jobs_service_spec.rb +36 -0
- data/spec/services/quiz_sync_job_service_spec.rb +41 -0
- data/spec/services/quiz_sync_jobs_service_spec.rb +77 -0
- data/spec/spec_helper.rb +1 -25
- metadata +11 -76
- data/spec/contracts/interaction_types_service_spec.rb +0 -22
- data/spec/contracts/item_analyses_service_spec.rb +0 -59
- data/spec/contracts/items_service_spec.rb +0 -59
- data/spec/contracts/qti_imports_service_spec.rb +0 -34
- data/spec/contracts/quiz_clone_job_service_spec.rb +0 -20
- data/spec/contracts/quiz_clone_jobs_service_spec.rb +0 -21
- data/spec/contracts/quiz_entries_service_spec.rb +0 -125
- data/spec/contracts/quiz_service_spec.rb +0 -68
- data/spec/contracts/quiz_session_events_service_spec.rb +0 -30
- data/spec/contracts/quiz_session_result_service_spec.rb +0 -42
- data/spec/contracts/quiz_session_service_spec.rb +0 -56
- data/spec/contracts/quiz_sessions_service_spec.rb +0 -28
- data/spec/contracts/quizzes_service_spec.rb +0 -80
- data/spec/contracts/session_item_results_service_spec.rb +0 -60
- data/spec/contracts/session_items_service_spec.rb +0 -21
- data/spec/contracts/shared_banks_spec.rb +0 -366
- data/spec/contracts/shared_examples/http_delete_example.rb +0 -56
- data/spec/contracts/shared_examples/http_get_example.rb +0 -139
- data/spec/contracts/shared_examples/http_patch_example.rb +0 -60
- data/spec/contracts/shared_examples/http_post_example.rb +0 -60
- data/spec/contracts/shared_examples/http_put_example.rb +0 -60
- data/spec/support/pact_config.rb +0 -64
- data/spec/support/pact_helper.rb +0 -19
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Slaughter
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: exe
|
16
16
|
cert_chain: []
|
17
|
-
date: 2022-
|
17
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: httparty
|
@@ -72,34 +72,6 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: pact
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '1.41'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '1.41'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: pact_broker-client
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '1.19'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '1.19'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: rake
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,6 +178,7 @@ files:
|
|
206
178
|
- lib/quiz_api_client/http_request/metrics.rb
|
207
179
|
- lib/quiz_api_client/json_formatter.rb
|
208
180
|
- lib/quiz_api_client/services/base_api_service.rb
|
181
|
+
- lib/quiz_api_client/services/courses_service.rb
|
209
182
|
- lib/quiz_api_client/services/interaction_types_service.rb
|
210
183
|
- lib/quiz_api_client/services/item_analyses_service.rb
|
211
184
|
- lib/quiz_api_client/services/items_service.rb
|
@@ -220,39 +193,21 @@ files:
|
|
220
193
|
- lib/quiz_api_client/services/quiz_session_result_service.rb
|
221
194
|
- lib/quiz_api_client/services/quiz_session_service.rb
|
222
195
|
- lib/quiz_api_client/services/quiz_sessions_service.rb
|
196
|
+
- lib/quiz_api_client/services/quiz_sync_job_service.rb
|
197
|
+
- lib/quiz_api_client/services/quiz_sync_jobs_service.rb
|
223
198
|
- lib/quiz_api_client/services/quizzes_service.rb
|
224
199
|
- lib/quiz_api_client/services/session_item_results_service.rb
|
225
200
|
- lib/quiz_api_client/services/session_items_service.rb
|
226
201
|
- lib/quiz_api_client/services/shared_banks.rb
|
227
202
|
- lib/quiz_api_client/version.rb
|
228
203
|
- spec/config_spec.rb
|
229
|
-
- spec/contracts/interaction_types_service_spec.rb
|
230
|
-
- spec/contracts/item_analyses_service_spec.rb
|
231
|
-
- spec/contracts/items_service_spec.rb
|
232
|
-
- spec/contracts/qti_imports_service_spec.rb
|
233
|
-
- spec/contracts/quiz_clone_job_service_spec.rb
|
234
|
-
- spec/contracts/quiz_clone_jobs_service_spec.rb
|
235
|
-
- spec/contracts/quiz_entries_service_spec.rb
|
236
|
-
- spec/contracts/quiz_service_spec.rb
|
237
|
-
- spec/contracts/quiz_session_events_service_spec.rb
|
238
|
-
- spec/contracts/quiz_session_result_service_spec.rb
|
239
|
-
- spec/contracts/quiz_session_service_spec.rb
|
240
|
-
- spec/contracts/quiz_sessions_service_spec.rb
|
241
|
-
- spec/contracts/quizzes_service_spec.rb
|
242
|
-
- spec/contracts/session_item_results_service_spec.rb
|
243
|
-
- spec/contracts/session_items_service_spec.rb
|
244
|
-
- spec/contracts/shared_banks_spec.rb
|
245
|
-
- spec/contracts/shared_examples/http_delete_example.rb
|
246
|
-
- spec/contracts/shared_examples/http_get_example.rb
|
247
|
-
- spec/contracts/shared_examples/http_patch_example.rb
|
248
|
-
- spec/contracts/shared_examples/http_post_example.rb
|
249
|
-
- spec/contracts/shared_examples/http_put_example.rb
|
250
204
|
- spec/http_client_spec.rb
|
251
205
|
- spec/json_formatter_spec.rb
|
252
206
|
- spec/quiz_api_client/http_request/failure_spec.rb
|
253
207
|
- spec/quiz_api_client/http_request/metrics_spec.rb
|
254
208
|
- spec/quiz_api_client_spec.rb
|
255
209
|
- spec/services/base_api_service_spec.rb
|
210
|
+
- spec/services/courses_service_spec.rb
|
256
211
|
- spec/services/interaction_types_service_spec.rb
|
257
212
|
- spec/services/item_analyses_service_spec.rb
|
258
213
|
- spec/services/items_service_spec.rb
|
@@ -267,12 +222,12 @@ files:
|
|
267
222
|
- spec/services/quiz_session_result_service_spec.rb
|
268
223
|
- spec/services/quiz_session_service_spec.rb
|
269
224
|
- spec/services/quiz_sessions_service_spec.rb
|
225
|
+
- spec/services/quiz_sync_job_service_spec.rb
|
226
|
+
- spec/services/quiz_sync_jobs_service_spec.rb
|
270
227
|
- spec/services/quizzes_service_spec.rb
|
271
228
|
- spec/services/session_item_results_service_spec.rb
|
272
229
|
- spec/services/session_items_service_spec.rb
|
273
230
|
- spec/spec_helper.rb
|
274
|
-
- spec/support/pact_config.rb
|
275
|
-
- spec/support/pact_helper.rb
|
276
231
|
homepage:
|
277
232
|
licenses: []
|
278
233
|
metadata: {}
|
@@ -297,33 +252,13 @@ specification_version: 4
|
|
297
252
|
summary: Ruby client for quiz_api
|
298
253
|
test_files:
|
299
254
|
- spec/config_spec.rb
|
300
|
-
- spec/contracts/interaction_types_service_spec.rb
|
301
|
-
- spec/contracts/item_analyses_service_spec.rb
|
302
|
-
- spec/contracts/items_service_spec.rb
|
303
|
-
- spec/contracts/qti_imports_service_spec.rb
|
304
|
-
- spec/contracts/quiz_clone_job_service_spec.rb
|
305
|
-
- spec/contracts/quiz_clone_jobs_service_spec.rb
|
306
|
-
- spec/contracts/quiz_entries_service_spec.rb
|
307
|
-
- spec/contracts/quiz_service_spec.rb
|
308
|
-
- spec/contracts/quiz_session_events_service_spec.rb
|
309
|
-
- spec/contracts/quiz_session_result_service_spec.rb
|
310
|
-
- spec/contracts/quiz_session_service_spec.rb
|
311
|
-
- spec/contracts/quiz_sessions_service_spec.rb
|
312
|
-
- spec/contracts/quizzes_service_spec.rb
|
313
|
-
- spec/contracts/session_item_results_service_spec.rb
|
314
|
-
- spec/contracts/session_items_service_spec.rb
|
315
|
-
- spec/contracts/shared_banks_spec.rb
|
316
|
-
- spec/contracts/shared_examples/http_delete_example.rb
|
317
|
-
- spec/contracts/shared_examples/http_get_example.rb
|
318
|
-
- spec/contracts/shared_examples/http_patch_example.rb
|
319
|
-
- spec/contracts/shared_examples/http_post_example.rb
|
320
|
-
- spec/contracts/shared_examples/http_put_example.rb
|
321
255
|
- spec/http_client_spec.rb
|
322
256
|
- spec/json_formatter_spec.rb
|
323
257
|
- spec/quiz_api_client/http_request/failure_spec.rb
|
324
258
|
- spec/quiz_api_client/http_request/metrics_spec.rb
|
325
259
|
- spec/quiz_api_client_spec.rb
|
326
260
|
- spec/services/base_api_service_spec.rb
|
261
|
+
- spec/services/courses_service_spec.rb
|
327
262
|
- spec/services/interaction_types_service_spec.rb
|
328
263
|
- spec/services/item_analyses_service_spec.rb
|
329
264
|
- spec/services/items_service_spec.rb
|
@@ -338,9 +273,9 @@ test_files:
|
|
338
273
|
- spec/services/quiz_session_result_service_spec.rb
|
339
274
|
- spec/services/quiz_session_service_spec.rb
|
340
275
|
- spec/services/quiz_sessions_service_spec.rb
|
276
|
+
- spec/services/quiz_sync_job_service_spec.rb
|
277
|
+
- spec/services/quiz_sync_jobs_service_spec.rb
|
341
278
|
- spec/services/quizzes_service_spec.rb
|
342
279
|
- spec/services/session_item_results_service_spec.rb
|
343
280
|
- spec/services/session_items_service_spec.rb
|
344
281
|
- spec/spec_helper.rb
|
345
|
-
- spec/support/pact_config.rb
|
346
|
-
- spec/support/pact_helper.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::InteractionTypesService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint' do
|
5
|
-
let(:provider_state) { 'a set of interaction types' }
|
6
|
-
let(:request_description) { 'a request to retrieve a list of interaction types' }
|
7
|
-
let(:quizzes_api_path) { '/api/interaction_types' }
|
8
|
-
let(:scope) { 'quiz.build' }
|
9
|
-
let(:params) { nil }
|
10
|
-
let(:response_body) do
|
11
|
-
Pact.each_like(
|
12
|
-
id: '1',
|
13
|
-
slug: 'choice',
|
14
|
-
name: 'Multiple Choice',
|
15
|
-
properties_schema: {},
|
16
|
-
scoring_algorithm_default: 'Equivalence',
|
17
|
-
user_response_type_options: ['Uuid']
|
18
|
-
)
|
19
|
-
end
|
20
|
-
let(:service_name) { :interaction_types_service }
|
21
|
-
end
|
22
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::ItemAnalysesService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402546] do
|
5
|
-
let(:request_description) { 'a request to retrieve item analyses all quiz_id items' }
|
6
|
-
let(:quiz_id) { 1 }
|
7
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/stats/item_analyses" }
|
8
|
-
let(:provider_state) { 'quiz with item analysis' }
|
9
|
-
let(:resource_id) { '1' }
|
10
|
-
let(:scope) { 'quiz.analysis' }
|
11
|
-
let(:params) { { quiz_id: '1' } }
|
12
|
-
let(:response_body) do
|
13
|
-
[
|
14
|
-
{
|
15
|
-
item_id: Pact.like('1'),
|
16
|
-
points_possible: Pact.like(1.0),
|
17
|
-
item_body: Pact.like('item body'),
|
18
|
-
interaction_type: 'choice',
|
19
|
-
item_analysis: {},
|
20
|
-
batch_timestamp: Pact.like('2017-06-15T22:14:51.215Z'),
|
21
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a')
|
22
|
-
},
|
23
|
-
{
|
24
|
-
item_id: Pact.like('1'),
|
25
|
-
points_possible: Pact.like(1.0),
|
26
|
-
item_body: Pact.like('item body'),
|
27
|
-
interaction_type: 'choice',
|
28
|
-
item_analysis: {},
|
29
|
-
batch_timestamp: Pact.like('2017-06-15T22:14:51.215Z'),
|
30
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a')
|
31
|
-
}
|
32
|
-
]
|
33
|
-
end
|
34
|
-
let(:service_name) { :item_analyses_service }
|
35
|
-
end
|
36
|
-
|
37
|
-
it_behaves_like 'a http get only request to quiz_api', testrail_id: %w[3402547] do
|
38
|
-
let(:request_description) { 'a request to retrieve item analyses for a quiz item' }
|
39
|
-
let(:quiz_id) { 1 }
|
40
|
-
let(:id) { 1 }
|
41
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/stats/item_analyses/#{id}" }
|
42
|
-
let(:provider_state) { 'quiz with item analysis' }
|
43
|
-
let(:resource_id) { '1' }
|
44
|
-
let(:scope) { 'quiz.analysis' }
|
45
|
-
let(:params) { { quiz_id: '1', id: '1' } }
|
46
|
-
let(:response_body) do
|
47
|
-
{
|
48
|
-
item_id: Pact.like('1'),
|
49
|
-
points_possible: Pact.like(1.0),
|
50
|
-
item_body: Pact.like('item body'),
|
51
|
-
interaction_type: 'choice',
|
52
|
-
item_analysis: {},
|
53
|
-
batch_timestamp: Pact.like('2017-06-15T22:14:51.215Z'),
|
54
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a')
|
55
|
-
}
|
56
|
-
end
|
57
|
-
let(:service_name) { :item_analyses_service }
|
58
|
-
end
|
59
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::ItemsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http post request to quiz_api' do
|
5
|
-
let(:provider_state) { 'a quiz and a multiple choice interaction type' }
|
6
|
-
let(:request_description) { 'a request to create an item' }
|
7
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/items" }
|
8
|
-
let(:resource_id) { '1' }
|
9
|
-
let(:scope) { 'quiz.build' }
|
10
|
-
let(:quiz_id) { 1 }
|
11
|
-
let(:params) do
|
12
|
-
{
|
13
|
-
quiz_id: quiz_id,
|
14
|
-
interaction_data: {
|
15
|
-
choices: [{
|
16
|
-
id: 'guid',
|
17
|
-
itemBody: '<p>Choice</p>',
|
18
|
-
position: 1
|
19
|
-
}]
|
20
|
-
},
|
21
|
-
interaction_type_id: 1, # we'll seed InteractionType::MultipleChoice
|
22
|
-
item_body: 'Some kind of stem',
|
23
|
-
properties: {},
|
24
|
-
scoring_algorithm: 'Equivalence',
|
25
|
-
scoring_data: {
|
26
|
-
value: 'another guid'
|
27
|
-
},
|
28
|
-
title: 'A perfectly cromulent title',
|
29
|
-
user_response_type: 'Uuid'
|
30
|
-
}
|
31
|
-
end
|
32
|
-
let(:item_params) { params.clone.tap { |p| p.delete(:quiz_id) } }
|
33
|
-
let(:body) { { quiz_id: quiz_id, item: item_params } }
|
34
|
-
let(:response_body) do
|
35
|
-
{
|
36
|
-
id: Pact.like('1'),
|
37
|
-
interaction_data: {
|
38
|
-
choices: Pact.each_like(
|
39
|
-
id: 'a guid',
|
40
|
-
item_body: 'choice description',
|
41
|
-
position: 1
|
42
|
-
)
|
43
|
-
},
|
44
|
-
item_body: Pact.like(''),
|
45
|
-
properties: Pact.like({}),
|
46
|
-
status: Pact.like(''),
|
47
|
-
title: Pact.like(''),
|
48
|
-
user_response_type: Pact.like(''),
|
49
|
-
stimulus_id: Pact.like(''),
|
50
|
-
interaction_type: Pact.like({}),
|
51
|
-
scoring_data: {
|
52
|
-
value: Pact.like('')
|
53
|
-
},
|
54
|
-
scoring_algorithm: Pact.like('')
|
55
|
-
}
|
56
|
-
end
|
57
|
-
let(:service_name) { :items_service }
|
58
|
-
end
|
59
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QtiImportsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http post request to quiz_api', testrail_id: %w[3402548] do
|
5
|
-
let(:request_description) { 'a request to import a QTI' }
|
6
|
-
let(:provider_state) { 'a quiz' }
|
7
|
-
let(:quiz_id) { 1 }
|
8
|
-
let(:url) { 'http://fake.url' }
|
9
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/qti_imports" }
|
10
|
-
let(:scope) { 'qti_import.create' }
|
11
|
-
let(:resource_id) { quiz_id }
|
12
|
-
let(:params) do
|
13
|
-
{
|
14
|
-
quiz_id: quiz_id,
|
15
|
-
url: url
|
16
|
-
}
|
17
|
-
end
|
18
|
-
let(:body) { { qti_import: params } }
|
19
|
-
let(:response_body) do
|
20
|
-
{
|
21
|
-
id: Pact.like('1'),
|
22
|
-
parent_id: quiz_id.to_s,
|
23
|
-
parent_type: Pact.like('Quiz'),
|
24
|
-
status: 'scheduled',
|
25
|
-
url: url,
|
26
|
-
message: Pact.like(''),
|
27
|
-
created_at: Pact.like(''),
|
28
|
-
updated_at: Pact.like(''),
|
29
|
-
progress: Pact.like(0.0)
|
30
|
-
}
|
31
|
-
end
|
32
|
-
let(:service_name) { :qti_imports_service }
|
33
|
-
end
|
34
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizCloneJobService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api' do
|
5
|
-
let(:request_description) { 'a request to retrieve a quiz clone job' }
|
6
|
-
let(:quizzes_api_path) { "/api/quiz_clone_jobs/#{resource_id}" }
|
7
|
-
let(:provider_state) { 'a quiz clone job' }
|
8
|
-
let(:scope) { 'quiz_clone_job.show' }
|
9
|
-
let(:params) { { id: resource_id } }
|
10
|
-
let(:resource_id) { '1' }
|
11
|
-
let(:response_body) do
|
12
|
-
{
|
13
|
-
id: Pact.like('1'),
|
14
|
-
original_quiz_id: Pact.like('1'),
|
15
|
-
status: Pact.like('scheduled')
|
16
|
-
}
|
17
|
-
end
|
18
|
-
let(:service_name) { :quiz_clone_job_service }
|
19
|
-
end
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizCloneJobsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http post request to quiz_api' do
|
5
|
-
let(:request_description) { 'a request to clone a quiz' }
|
6
|
-
let(:quizzes_api_path) { "/api/quizzes/#{resource_id}/quiz_clone_jobs" }
|
7
|
-
let(:provider_state) { 'a quiz' }
|
8
|
-
let(:scope) { 'quiz.clone' }
|
9
|
-
let(:params) { { quiz_id: resource_id } }
|
10
|
-
let(:body) { {} }
|
11
|
-
let(:resource_id) { '1' }
|
12
|
-
let(:response_body) do
|
13
|
-
{
|
14
|
-
id: Pact.like('1'),
|
15
|
-
original_quiz_id: Pact.like('1'),
|
16
|
-
status: Pact.like('scheduled')
|
17
|
-
}
|
18
|
-
end
|
19
|
-
let(:service_name) { :quiz_clone_jobs_service }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizEntriesService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402549] do
|
5
|
-
let(:request_description) { 'a request to retrieve a list of quiz entries' }
|
6
|
-
let(:quiz_id) { 1 }
|
7
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/quiz_entries" }
|
8
|
-
let(:provider_state) { 'a set of quiz entries' }
|
9
|
-
let(:resource_id) { '1' }
|
10
|
-
let(:scope) { 'quiz.build' }
|
11
|
-
let(:params) { { id: '1' } }
|
12
|
-
let(:response_body) do
|
13
|
-
[
|
14
|
-
{
|
15
|
-
entry_editable: Pact.like(true),
|
16
|
-
entry_type: 'Item',
|
17
|
-
id: Pact.like('1'),
|
18
|
-
position: Pact.like(0),
|
19
|
-
properties: {},
|
20
|
-
regrade_adjusted_points_possible: nil,
|
21
|
-
status: 'mutable',
|
22
|
-
stimulus_quiz_entry_id: Pact.like('1'),
|
23
|
-
entry: {
|
24
|
-
id: Pact.like('1'),
|
25
|
-
title: Pact.like('item 1 title'),
|
26
|
-
label: Pact.like('item 1 label'),
|
27
|
-
user_response_type: Pact.like('Uuid'),
|
28
|
-
item_body: Pact.like('item 1 body'),
|
29
|
-
interaction_data: Pact.like({}),
|
30
|
-
interaction_type: {
|
31
|
-
id: Pact.like('1')
|
32
|
-
}
|
33
|
-
}
|
34
|
-
},
|
35
|
-
{
|
36
|
-
entry_editable: Pact.like(true),
|
37
|
-
entry_type: 'Item',
|
38
|
-
id: Pact.like('1'),
|
39
|
-
position: Pact.like(0),
|
40
|
-
properties: {},
|
41
|
-
regrade_adjusted_points_possible: nil,
|
42
|
-
status: 'mutable',
|
43
|
-
stimulus_quiz_entry_id: Pact.like('1'),
|
44
|
-
entry: {
|
45
|
-
id: Pact.like('1'),
|
46
|
-
title: Pact.like('item 1 title'),
|
47
|
-
label: Pact.like('item 1 label'),
|
48
|
-
user_response_type: Pact.like('Uuid'),
|
49
|
-
item_body: Pact.like('item 1 body'),
|
50
|
-
interaction_data: Pact.like({}),
|
51
|
-
interaction_type: {
|
52
|
-
id: Pact.like('1')
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
]
|
57
|
-
end
|
58
|
-
let(:service_name) { :quiz_entries_service }
|
59
|
-
end
|
60
|
-
|
61
|
-
it_behaves_like 'a http post request to quiz_api' do
|
62
|
-
let(:request_description) { 'a request to create a quiz entry' }
|
63
|
-
let(:quiz_id) { 1 }
|
64
|
-
let(:resource_id) { quiz_id }
|
65
|
-
let(:provider_state) { 'a quiz with an item' }
|
66
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/quiz_entries" }
|
67
|
-
let(:scope) { 'quiz.build' }
|
68
|
-
let(:params) do
|
69
|
-
{
|
70
|
-
id: quiz_id,
|
71
|
-
quiz_id: quiz_id,
|
72
|
-
entry_type: 'Item',
|
73
|
-
entry_id: 1,
|
74
|
-
points_possible: 1,
|
75
|
-
position: 1,
|
76
|
-
properties: {
|
77
|
-
points_possible: 1,
|
78
|
-
position: 1
|
79
|
-
}
|
80
|
-
}
|
81
|
-
end
|
82
|
-
let(:body) { { quiz_entry: params } }
|
83
|
-
let(:response_body) do
|
84
|
-
{
|
85
|
-
entry_editable: Pact.like(true),
|
86
|
-
entry_type: 'Item',
|
87
|
-
id: Pact.like('1'),
|
88
|
-
position: Pact.like(0),
|
89
|
-
properties: Pact.like({}),
|
90
|
-
regrade_adjusted_points_possible: nil,
|
91
|
-
status: 'mutable',
|
92
|
-
stimulus_quiz_entry_id: Pact.like('1'),
|
93
|
-
entry: {
|
94
|
-
id: Pact.like('1'),
|
95
|
-
title: Pact.like('item 1 title'),
|
96
|
-
label: Pact.like('item 1 label'),
|
97
|
-
user_response_type: Pact.like('Uuid'),
|
98
|
-
item_body: Pact.like('item 1 body'),
|
99
|
-
interaction_data: Pact.like({}),
|
100
|
-
interaction_type: {
|
101
|
-
id: Pact.like('1')
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
end
|
106
|
-
let(:service_name) { :quiz_entries_service }
|
107
|
-
end
|
108
|
-
|
109
|
-
it_behaves_like 'a http delete request to quiz_api' do
|
110
|
-
let(:request_description) { 'a request to delete a quiz entry' }
|
111
|
-
let(:quiz_id) { 1 }
|
112
|
-
let(:item_id) { 1 }
|
113
|
-
let(:resource_id) { quiz_id }
|
114
|
-
let(:provider_state) { 'a set of quiz entries' }
|
115
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/quiz_entries/#{item_id}" }
|
116
|
-
let(:scope) { 'quiz.build' }
|
117
|
-
let(:params) do
|
118
|
-
{
|
119
|
-
quiz_id: quiz_id,
|
120
|
-
id: item_id
|
121
|
-
}
|
122
|
-
end
|
123
|
-
let(:service_name) { :quiz_entries_service }
|
124
|
-
end
|
125
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api', testrail_id: %w[3402550] do
|
5
|
-
let(:service_name) { :quiz_service }
|
6
|
-
let(:request_description) { 'a request to retrieve a single quiz' }
|
7
|
-
let(:quizzes_api_path) { '/api/quizzes/1' }
|
8
|
-
let(:provider_state) { 'a quiz' }
|
9
|
-
let(:scope) { 'quiz.build' }
|
10
|
-
let(:params) { { id: '1' } }
|
11
|
-
let(:resource_id) { '1' }
|
12
|
-
let(:response_body) do
|
13
|
-
{
|
14
|
-
id: Pact.like('1'),
|
15
|
-
title: Pact.like('quiz title'),
|
16
|
-
context_id: Pact.like('1'),
|
17
|
-
session_time_limit_in_seconds: Pact.like(1),
|
18
|
-
instructions: Pact.like('quiz instructions'),
|
19
|
-
shuffle_questions: Pact.like(false),
|
20
|
-
shuffle_answers: Pact.like(false),
|
21
|
-
status: 'uninitialized',
|
22
|
-
owner: Pact.like('teacher'),
|
23
|
-
has_time_limit: Pact.like(false),
|
24
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a'),
|
25
|
-
one_at_a_time_type: 'question',
|
26
|
-
allow_backtracking: Pact.like(true)
|
27
|
-
}
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it_behaves_like 'a http patch request to quiz_api', testrail_id: %w[3402551] do
|
32
|
-
let(:service_name) { :quiz_service }
|
33
|
-
let(:request_description) { 'a request to update a quiz' }
|
34
|
-
let(:quizzes_api_path) { '/api/quizzes/1' }
|
35
|
-
let(:provider_state) { 'a quiz' }
|
36
|
-
let(:scope) { 'quiz.build' }
|
37
|
-
let(:title) { 'some new title' }
|
38
|
-
let(:params) do
|
39
|
-
{
|
40
|
-
id: '1',
|
41
|
-
title: title
|
42
|
-
}
|
43
|
-
end
|
44
|
-
let(:resource_id) { '1' }
|
45
|
-
let(:body) { { quiz: params } }
|
46
|
-
let(:response_body) do
|
47
|
-
{
|
48
|
-
id: Pact.like('1'),
|
49
|
-
title: title,
|
50
|
-
instructions: Pact.like('quiz instructions'),
|
51
|
-
context_id: Pact.like('1'),
|
52
|
-
owner: Pact.like('teacher1'),
|
53
|
-
has_time_limit: Pact.like(false),
|
54
|
-
allow_backtracking: Pact.like(true),
|
55
|
-
one_at_a_time_type: 'question',
|
56
|
-
session_time_limit_in_seconds: 0,
|
57
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a'),
|
58
|
-
require_student_access_code: Pact.like(false),
|
59
|
-
filter_ip_address: Pact.like(false),
|
60
|
-
shuffle_questions: Pact.like(false),
|
61
|
-
shuffle_answers: Pact.like(false),
|
62
|
-
status: 'unpublished',
|
63
|
-
student_access_code: Pact.like('3uXc15S3B'),
|
64
|
-
filters: Pact.like({})
|
65
|
-
}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSessionEventsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402552] do
|
5
|
-
let(:request_description) { 'a request to retrieve a list of quiz entries' }
|
6
|
-
let(:quiz_session_id) { 1 }
|
7
|
-
let(:quizzes_api_path) { "/api/quiz_sessions/#{quiz_session_id}/quiz_session_events" }
|
8
|
-
let(:provider_state) { 'set of session events' }
|
9
|
-
let(:resource_id) { '1' }
|
10
|
-
let(:scope) { 'quiz_sessions.log' }
|
11
|
-
let(:params) { { quiz_session_id: '1' } }
|
12
|
-
let(:response_body) do
|
13
|
-
[
|
14
|
-
{
|
15
|
-
created_at: Pact.like(''),
|
16
|
-
event_type: Pact.like(''),
|
17
|
-
event_data: {},
|
18
|
-
quiz_session_id: Pact.like('1')
|
19
|
-
},
|
20
|
-
{
|
21
|
-
created_at: Pact.like(''),
|
22
|
-
event_type: Pact.like(''),
|
23
|
-
event_data: {},
|
24
|
-
quiz_session_id: Pact.like('1')
|
25
|
-
}
|
26
|
-
]
|
27
|
-
end
|
28
|
-
let(:service_name) { :quiz_session_events_service }
|
29
|
-
end
|
30
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSessionResultService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api', testrail_id: %w[3402553] do
|
5
|
-
let(:request_description) { 'a request to retrieve a quiz session result' }
|
6
|
-
let(:id) { 1 }
|
7
|
-
let(:quizzes_api_path) { "/api/results/#{id}" }
|
8
|
-
let(:provider_state) { 'a quiz session result' }
|
9
|
-
let(:resource_id) { '1' }
|
10
|
-
let(:scope) { 'quiz_session_result.show' }
|
11
|
-
let(:params) { { id: '1' } }
|
12
|
-
let(:response_body) do
|
13
|
-
{
|
14
|
-
created_at: Pact.like(''),
|
15
|
-
fudge_points: Pact.like(1.0),
|
16
|
-
grading_method: 'autograde',
|
17
|
-
id: Pact.like('1'),
|
18
|
-
percentage: Pact.like(1.0),
|
19
|
-
quiz_session_id: Pact.like('1'),
|
20
|
-
score: Pact.like(1.0),
|
21
|
-
status: 'graded',
|
22
|
-
quiz_session: {
|
23
|
-
id: Pact.like('1'),
|
24
|
-
account_uuid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a'),
|
25
|
-
end_at: nil,
|
26
|
-
start_at: Pact.like(''),
|
27
|
-
status: 'graded',
|
28
|
-
metadata: nil,
|
29
|
-
accepted_student_access_code: Pact.like(false),
|
30
|
-
attempt: Pact.like(1),
|
31
|
-
disable_timer: nil,
|
32
|
-
extra_time_in_seconds: nil,
|
33
|
-
timer_multiplier: nil,
|
34
|
-
elapsed_time: Pact.like(3600),
|
35
|
-
allow_backtracking: nil,
|
36
|
-
one_at_a_time_type: nil
|
37
|
-
}
|
38
|
-
}
|
39
|
-
end
|
40
|
-
let(:service_name) { :quiz_session_result_service }
|
41
|
-
end
|
42
|
-
end
|