quiz_api_client 4.3.0 → 4.5.1
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/version.rb +1 -1
- data/lib/quiz_api_client.rb +5 -0
- data/spec/quiz_api_client_spec.rb +7 -0
- data/spec/services/courses_service_spec.rb +103 -0
- data/spec/spec_helper.rb +1 -25
- metadata +11 -86
- 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/quiz_sync_job_service_spec.rb +0 -21
- data/spec/contracts/quiz_sync_jobs_service_spec.rb +0 -21
- 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 -68
- 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
@@ -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
|
@@ -1,56 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSessionService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api', testrail_id: %w[3402554] do
|
5
|
-
let(:request_description) { 'a request to retrieve the graded quiz session' }
|
6
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1' }
|
7
|
-
let(:provider_state) { 'a graded quiz session' }
|
8
|
-
let(:scope) { 'quiz_session.show' }
|
9
|
-
let(:params) { { id: '1' } }
|
10
|
-
let(:resource_id) { '1' }
|
11
|
-
let(:response_body) do
|
12
|
-
{
|
13
|
-
id: Pact.like('1'),
|
14
|
-
account_uuid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a'),
|
15
|
-
end_at: nil,
|
16
|
-
start_at: Pact.like(''),
|
17
|
-
status: 'graded',
|
18
|
-
metadata: nil,
|
19
|
-
accepted_student_access_code: Pact.like(false),
|
20
|
-
attempt: Pact.like(1),
|
21
|
-
disable_timer: nil,
|
22
|
-
extra_time_in_seconds: nil,
|
23
|
-
timer_multiplier: nil,
|
24
|
-
elapsed_time: Pact.like(3600),
|
25
|
-
allow_backtracking: nil,
|
26
|
-
one_at_a_time_type: nil
|
27
|
-
}
|
28
|
-
end
|
29
|
-
let(:service_name) { :quiz_session_service }
|
30
|
-
end
|
31
|
-
|
32
|
-
it_behaves_like 'a http patch request to quiz_api', testrail_id: %w[3402555] do
|
33
|
-
let(:request_description) { 'a request to update a quiz session' }
|
34
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1' }
|
35
|
-
let(:provider_state) { 'a quiz session' }
|
36
|
-
let(:scope) { 'quiz_session.update' }
|
37
|
-
let(:attempt) { 2 }
|
38
|
-
let(:params) do
|
39
|
-
{
|
40
|
-
id: '1',
|
41
|
-
attempt: { attempt: 2 }
|
42
|
-
}
|
43
|
-
end
|
44
|
-
let(:resource_id) { '1' }
|
45
|
-
let(:body) { { quiz_session: params } }
|
46
|
-
let(:response_body) do
|
47
|
-
{
|
48
|
-
id: Pact.like('1'),
|
49
|
-
status: 'graded',
|
50
|
-
start_at: Pact.like(''),
|
51
|
-
end_at: Pact.like('')
|
52
|
-
}
|
53
|
-
end
|
54
|
-
let(:service_name) { :quiz_session_service }
|
55
|
-
end
|
56
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSessionsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http post request to quiz_api', testrail_id: %w[3402556] do
|
5
|
-
let(:request_description) { 'a request to create a quiz session' }
|
6
|
-
let(:provider_state) { 'a quiz' }
|
7
|
-
let(:quiz_id) { 1 }
|
8
|
-
let(:quizzes_api_path) { "/api/quizzes/#{quiz_id}/quiz_sessions" }
|
9
|
-
let(:scope) { 'quiz_session.create' }
|
10
|
-
let(:resource_id) { quiz_id }
|
11
|
-
let(:params) do
|
12
|
-
{
|
13
|
-
quiz_id: quiz_id,
|
14
|
-
attempt: 1
|
15
|
-
}
|
16
|
-
end
|
17
|
-
let(:body) { { quiz_session: params } }
|
18
|
-
let(:response_body) do
|
19
|
-
{
|
20
|
-
id: Pact.like('1'),
|
21
|
-
status: 'pending',
|
22
|
-
start_at: Pact.like(''),
|
23
|
-
end_at: Pact.like('')
|
24
|
-
}
|
25
|
-
end
|
26
|
-
let(:service_name) { :quiz_sessions_service }
|
27
|
-
end
|
28
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSyncJobService, :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 sync job' }
|
6
|
-
let(:quizzes_api_path) { "/api/quiz_sync_jobs/#{resource_id}" }
|
7
|
-
let(:provider_state) { 'a quiz sync job' }
|
8
|
-
let(:scope) { 'quiz_sync_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
|
-
cloned_quiz_id: Pact.like('2'),
|
16
|
-
status: Pact.like('scheduled')
|
17
|
-
}
|
18
|
-
end
|
19
|
-
let(:service_name) { :quiz_sync_job_service }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizSyncJobsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http post request to quiz_api' do
|
5
|
-
let(:batch) { true }
|
6
|
-
let(:request_description) { 'a request to sync many quizzes' }
|
7
|
-
let(:quizzes_api_path) { '/api/quiz_sync_jobs/create_batch' }
|
8
|
-
let(:provider_state) { 'a completed quiz clone job' }
|
9
|
-
let(:scope) { 'quiz_sync_job.create_batch' }
|
10
|
-
let(:params) { { quiz_ids: ['1'] } }
|
11
|
-
let(:body) { { quiz_ids: ['1'] } }
|
12
|
-
let(:response_body) do
|
13
|
-
[
|
14
|
-
{
|
15
|
-
id: Pact.like('1')
|
16
|
-
}
|
17
|
-
]
|
18
|
-
end
|
19
|
-
let(:service_name) { :quiz_sync_jobs_service }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::QuizzesService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
|
4
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402557] do
|
5
|
-
let(:request_description) { 'a request specifying a quiz id' }
|
6
|
-
let(:quizzes_api_path) { '/api/quizzes' }
|
7
|
-
let(:provider_state) { 'a quiz' }
|
8
|
-
let(:scope) { 'quiz.list' }
|
9
|
-
let(:params) { { 'id' => '1' } }
|
10
|
-
let(:query_params) { { 'id' => '1' } }
|
11
|
-
let(:response_body) do
|
12
|
-
[
|
13
|
-
{
|
14
|
-
# TODO: figure out why Pact specs' responses for GET requests from
|
15
|
-
# quiz_api have integers for *ID fields given quiz_api actually returns strings
|
16
|
-
id: Pact.like(1),
|
17
|
-
title: Pact.like('quiz title'),
|
18
|
-
context_id: Pact.like(1),
|
19
|
-
outcome_declaration: nil,
|
20
|
-
session_time_limit_in_seconds: Pact.like(1),
|
21
|
-
quiz_type: nil,
|
22
|
-
minimum_passing_score: nil,
|
23
|
-
lti_resource_id: nil,
|
24
|
-
created_at: Pact.like('2017-06-15T22:14:51.215Z'),
|
25
|
-
updated_at: Pact.like('2017-06-15T22:14:51.215Z'),
|
26
|
-
instructions: Pact.like('quiz instructions'),
|
27
|
-
shuffle_questions: Pact.like(false),
|
28
|
-
shuffle_answers: Pact.like(false),
|
29
|
-
status: 'uninitialized',
|
30
|
-
owner: Pact.like('teacher'),
|
31
|
-
has_time_limit: Pact.like(false),
|
32
|
-
outcome_alignment_set_guid: Pact.like('cbedd9b0-d1ab-43a9-a3b2-89c3134a722a'),
|
33
|
-
one_at_a_time_type: 'question',
|
34
|
-
allow_backtracking: Pact.like(true)
|
35
|
-
}
|
36
|
-
]
|
37
|
-
end
|
38
|
-
let(:service_name) { :quizzes_service }
|
39
|
-
end
|
40
|
-
|
41
|
-
it_behaves_like 'a http post request to quiz_api', testrails_id: %w[3402558] do
|
42
|
-
let(:request_description) { 'a request to create a quiz' }
|
43
|
-
let(:quizzes_api_path) { '/api/quizzes' }
|
44
|
-
let(:provider_state) { 'a context' }
|
45
|
-
let(:scope) { 'quiz.create' }
|
46
|
-
let(:title) { 'Pop Quiz' }
|
47
|
-
let(:instructions) { 'Select the best answer.' }
|
48
|
-
let(:context_id) { '1' }
|
49
|
-
let(:params) do
|
50
|
-
{
|
51
|
-
'title' => title,
|
52
|
-
'instructions' => instructions,
|
53
|
-
'context_id' => context_id
|
54
|
-
}
|
55
|
-
end
|
56
|
-
let(:body) { { quiz: params } }
|
57
|
-
let(:response_body) do
|
58
|
-
{
|
59
|
-
id: Pact.like('1'),
|
60
|
-
title: title,
|
61
|
-
instructions: instructions,
|
62
|
-
context_id: context_id,
|
63
|
-
owner: Pact.like('teacher1'),
|
64
|
-
has_time_limit: Pact.like(false),
|
65
|
-
allow_backtracking: Pact.like(true),
|
66
|
-
one_at_a_time_type: 'none',
|
67
|
-
session_time_limit_in_seconds: 0,
|
68
|
-
outcome_alignment_set_guid: nil,
|
69
|
-
require_student_access_code: Pact.like(false),
|
70
|
-
filter_ip_address: Pact.like(false),
|
71
|
-
shuffle_questions: Pact.like(false),
|
72
|
-
shuffle_answers: Pact.like(false),
|
73
|
-
status: 'uninitialized',
|
74
|
-
student_access_code: nil,
|
75
|
-
filters: Pact.like({})
|
76
|
-
}
|
77
|
-
end
|
78
|
-
let(:service_name) { :quizzes_service }
|
79
|
-
end
|
80
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::SessionItemResultsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402559] do
|
4
|
-
let(:request_description) { 'a request to retrieve a session item result' }
|
5
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1/results/1/session_item_results' }
|
6
|
-
let(:provider_state) { 'a set of session_item_results' }
|
7
|
-
let(:resource_id) { '1' }
|
8
|
-
let(:scope) { 'quiz_session.results' }
|
9
|
-
let(:params) { { quiz_session_id: '1', quiz_session_result_id: '1' } }
|
10
|
-
let(:response_body) do
|
11
|
-
[
|
12
|
-
{
|
13
|
-
position: Pact.like(1),
|
14
|
-
attempt: Pact.like(1),
|
15
|
-
item_id: Pact.like('1'),
|
16
|
-
graded_at: Pact.like('2017-06-15T22:14:51.215Z'),
|
17
|
-
grading_method: 'autograde',
|
18
|
-
points_possible: Pact.like(1.0),
|
19
|
-
score: Pact.like(1.0),
|
20
|
-
scored_data: {},
|
21
|
-
feedback: {}
|
22
|
-
}
|
23
|
-
]
|
24
|
-
end
|
25
|
-
let(:service_name) { :session_item_results_service }
|
26
|
-
end
|
27
|
-
|
28
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint' do
|
29
|
-
let(:request_description) { 'a request to retrieve a session item result for all interaction_types' }
|
30
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1/results/1/session_item_results' }
|
31
|
-
let(:provider_state) { 'a set of session_item_results of autograded interaction_types' }
|
32
|
-
let(:resource_id) { '1' }
|
33
|
-
let(:scope) { 'quiz_session.results' }
|
34
|
-
let(:params) { { quiz_session_id: '1', quiz_session_result_id: '1' } }
|
35
|
-
let(:response_body) do
|
36
|
-
Pact.each_like(
|
37
|
-
grading_method: 'autograde',
|
38
|
-
score: Pact.like(1.0)
|
39
|
-
)
|
40
|
-
end
|
41
|
-
let(:service_name) { :session_item_results_service }
|
42
|
-
end
|
43
|
-
|
44
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint' do
|
45
|
-
let(:request_description) { 'a request to retrieve a session item result for manually graded interaction_types' }
|
46
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1/results/1/session_item_results' }
|
47
|
-
let(:provider_state) { 'a set of session_item_results of manually graded interaction_types' }
|
48
|
-
let(:resource_id) { '1' }
|
49
|
-
let(:scope) { 'quiz_session.results' }
|
50
|
-
let(:params) { { quiz_session_id: '1', quiz_session_result_id: '1' } }
|
51
|
-
let(:response_body) do
|
52
|
-
Pact.each_like(
|
53
|
-
graded_at: Pact.like('2017-06-15T22:14:51.215Z'),
|
54
|
-
grading_method: 'manual_grading',
|
55
|
-
score: Pact.like(1.0)
|
56
|
-
)
|
57
|
-
end
|
58
|
-
let(:service_name) { :session_item_results_service }
|
59
|
-
end
|
60
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
describe QuizApiClient::Services::SessionItemsService, :pact do
|
2
|
-
include PactHelper
|
3
|
-
it_behaves_like 'a http get request to quiz_api collection endpoint', testrail_id: %w[3402560] do
|
4
|
-
let(:request_description) { 'a request to retrieve a session item' }
|
5
|
-
let(:quizzes_api_path) { '/api/quiz_sessions/1/session_items' }
|
6
|
-
let(:provider_state) { 'a set of session_items' }
|
7
|
-
let(:scope) { 'quiz_session.results' }
|
8
|
-
let(:resource_id) { '1' }
|
9
|
-
let(:params) { { quiz_session_id: '1' } }
|
10
|
-
let(:response_body) do
|
11
|
-
[
|
12
|
-
{
|
13
|
-
position: Pact.like(1),
|
14
|
-
item: {},
|
15
|
-
points_possible: Pact.like(1.0)
|
16
|
-
}
|
17
|
-
]
|
18
|
-
end
|
19
|
-
let(:service_name) { :session_items_service }
|
20
|
-
end
|
21
|
-
end
|