quiz_api_client 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -48
  3. data/Rakefile +0 -29
  4. data/lib/quiz_api_client/services/courses_service.rb +11 -0
  5. data/lib/quiz_api_client/version.rb +1 -1
  6. data/spec/services/courses_service_spec.rb +39 -0
  7. data/spec/spec_helper.rb +1 -25
  8. metadata +2 -80
  9. data/spec/contracts/interaction_types_service_spec.rb +0 -22
  10. data/spec/contracts/item_analyses_service_spec.rb +0 -59
  11. data/spec/contracts/items_service_spec.rb +0 -59
  12. data/spec/contracts/qti_imports_service_spec.rb +0 -34
  13. data/spec/contracts/quiz_clone_job_service_spec.rb +0 -20
  14. data/spec/contracts/quiz_clone_jobs_service_spec.rb +0 -21
  15. data/spec/contracts/quiz_entries_service_spec.rb +0 -125
  16. data/spec/contracts/quiz_service_spec.rb +0 -68
  17. data/spec/contracts/quiz_session_events_service_spec.rb +0 -30
  18. data/spec/contracts/quiz_session_result_service_spec.rb +0 -42
  19. data/spec/contracts/quiz_session_service_spec.rb +0 -56
  20. data/spec/contracts/quiz_sessions_service_spec.rb +0 -28
  21. data/spec/contracts/quiz_sync_job_service_spec.rb +0 -21
  22. data/spec/contracts/quiz_sync_jobs_service_spec.rb +0 -21
  23. data/spec/contracts/quizzes_service_spec.rb +0 -80
  24. data/spec/contracts/session_item_results_service_spec.rb +0 -60
  25. data/spec/contracts/session_items_service_spec.rb +0 -21
  26. data/spec/contracts/shared_banks_spec.rb +0 -366
  27. data/spec/contracts/shared_examples/http_delete_example.rb +0 -56
  28. data/spec/contracts/shared_examples/http_get_example.rb +0 -139
  29. data/spec/contracts/shared_examples/http_patch_example.rb +0 -60
  30. data/spec/contracts/shared_examples/http_post_example.rb +0 -68
  31. data/spec/contracts/shared_examples/http_put_example.rb +0 -60
  32. data/spec/support/pact_config.rb +0 -64
  33. data/spec/support/pact_helper.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e1f12f936c33b3cf09fe4f8475aa40dfc7dbde37e65ed81b7d62ef07d23c86c
4
- data.tar.gz: 9b4895c5dedd2d56fb64a79d2d03e5c6a8989832a9a51f912920fd71aa67582b
3
+ metadata.gz: 20c474d0431dbdf5c2cf34902592b90336b535e1d5d9197570fa727b5d6cbb00
4
+ data.tar.gz: c029697bd27fae184dd98e524cfe94fdc4525b3fea9fb8163ae0d06e4d8a719e
5
5
  SHA512:
6
- metadata.gz: '009317d5880a188a2ba3ed14f1b937fc34b35f169ab819aaedfd57c09550b5a9acea19db12d6ca8591c13cd41b252e200d82022a236cfdd6f6271a682496ee38'
7
- data.tar.gz: 5f8059807154051560b72466ad20452f4f42b771e528ed1a9235d3eca12e0e802af9ca7fe5434dcd740dd808908181357474659bd6c66af25d9ff0072d0ee949
6
+ metadata.gz: c333252cda2aac00b2704651253493fb2fc0e8a50c4a9687605b54ea8bd6fb8da1ebbbda039daa019fec9f5b726cab6b1566ced7e72e9970830950f697195577
7
+ data.tar.gz: 66c6aafb605ccc6c54fc8d7f7c3c3d3055d017984ac4dba6fb5c1be8f085abb72bdb3bf8e8b531da3a1cbc2a3db7aea3648b38e6f31644ba98bc0df4e5615c0f
data/README.md CHANGED
@@ -187,51 +187,3 @@ Then, run `bundle exec rake spec` to run the tests.
187
187
  You can also run `bundle exec rake console` for an interactive prompt that will allow you to experiment.
188
188
 
189
189
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
190
-
191
- When you add or modify a service, be sure to add or modify contract tests!
192
-
193
- ## Contract Tests
194
-
195
- We use [Pact](https://docs.pact.io/) for our contract testing. To generate
196
- a Pact file, run `bin/contracts-generate`. The script will generate the Pact
197
- file and place it in the pacts/ directory. It will also attempt to publish the
198
- Pact file to a local Pact Broker.
199
-
200
- ### Development Workflow:
201
-
202
- 1. In the quiz_api repo, spin up the Quiz API service with `bin/setup`
203
- 2. In the quiz_pact_broker repo, spin up a Pact Broker with `bin/dev-setup`
204
- 3. In the quiz_api repo, write Pact provider states in the
205
- spec/service_consumers/api/quiz_api_client_ruby/ directory as needed
206
- 4. In this repo's spec/contracts/ directory, write or modify a contract test
207
- 5. In this repo, run `bin/contracts-generate` to generate a Pact file and
208
- publish it to the Pact Broker
209
- 6. In the quiz_api repo, run `bin/contracts` to pull the new Pact file from
210
- the Pact Broker and run the updated contract tests against the Quiz API service
211
-
212
- Bonus: You can view your Pact file in the Pact Broker at http://pact-broker.docker
213
- along with some cool goodies!
214
-
215
- ### Debugging Failures
216
-
217
- Pact has some basic RSpec output for failed specs. It also keeps a log in
218
- `log/pact.log` and offers general pointers for debugging.
219
-
220
- Above all, learn the Pact [basics](https://docs.pact.io/documentation/matching.html).
221
-
222
- ### What should contract tests cover?
223
-
224
- The aim of contract testing here is *not* to test all functional requirements
225
- of the Quiz API service. Rather, the goal is to ensure changes to the Quiz API
226
- service don't break its clients. We can best accomplish this with the
227
- following contract test coverage:
228
-
229
- - Basic happy path requests for all endpoints (POST, GET, PUT, DELETE)
230
- - Basic error paths for all endpoints (verify the error messages and/or HTTP
231
- response codes are accurate)
232
- - Resource state management; for example, when a quiz attempt is submitted but
233
- not yet graded
234
- - Special edge case errors
235
-
236
- Again, what *not* to test: the functional behavior of the service; for
237
- example, a series of sequential API calls to test a full user scenario.
data/Rakefile CHANGED
@@ -1,7 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'pact_broker/client/tasks'
3
2
  require 'rspec/core/rake_task'
4
- require_relative './spec/support/pact_config'
5
3
 
6
4
  RSpec::Core::RakeTask.new(:spec)
7
5
 
@@ -19,30 +17,3 @@ task :console do
19
17
  ARGV.clear
20
18
  Pry.start
21
19
  end
22
-
23
- # see https://github.com/pact-foundation/pact_broker-client/blob/master/README.md
24
- namespace :broker do
25
- PactBroker::Client::PublicationTask.new(:local) do |task|
26
- prepare_pact_files_for_publishing(task)
27
- end
28
-
29
- PactBroker::Client::PublicationTask.new(:jenkins_post_merge) do |task|
30
- prepare_pact_files_for_publishing(task)
31
- end
32
-
33
- def prepare_pact_files_for_publishing(task)
34
- task.pattern = 'pacts/*.json'
35
-
36
- task.pact_broker_base_url = PactConfig.broker_host
37
- task.pact_broker_basic_auth = {
38
- username: PactConfig.broker_username,
39
- password: PactConfig.broker_password
40
- }
41
-
42
- task.consumer_version = PactConfig.consumer_version
43
- puts "Consumer version: #{task.consumer_version}"
44
-
45
- task.tag = PactConfig.consumer_tag
46
- puts "Pact file tagged with: #{task.tag}"
47
- end
48
- end
@@ -4,6 +4,10 @@ module QuizApiClient::Services
4
4
  post_to_quiz_api(params: params, token: token)
5
5
  end
6
6
 
7
+ def update(params:, token: nil)
8
+ patch_to_quiz_api(params: params, token: token)
9
+ end
10
+
7
11
  def destroy(params:, token: nil)
8
12
  delete_from_quiz_api(params: params, token: token)
9
13
  end
@@ -17,6 +21,13 @@ module QuizApiClient::Services
17
21
  )
18
22
  end
19
23
 
24
+ def patch_to_quiz_api(params:, token:)
25
+ client(token: token).patch(
26
+ "/api/courses/#{params[:canvas_id]}",
27
+ course: params.tap { |p| p.delete(:canvas_id) }
28
+ )
29
+ end
30
+
20
31
  def delete_from_quiz_api(params:, token:)
21
32
  client(token: token).delete(
22
33
  "/api/courses/#{params[:canvas_id]}"
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.4.0'.freeze
2
+ VERSION = '4.5.0'.freeze
3
3
  end
@@ -42,6 +42,45 @@ describe QuizApiClient::Services::CoursesService do
42
42
  end
43
43
  end
44
44
 
45
+ describe '#update' do
46
+ let(:params) do
47
+ {
48
+ canvas_id: 4,
49
+ title: 'foo',
50
+ is_blueprint: true
51
+ }
52
+ end
53
+
54
+ let(:response) do
55
+ {
56
+ 'id' => '4',
57
+ 'title' => 'foo',
58
+ 'canvas_id' => '2',
59
+ 'is_blueprint' => true,
60
+ 'created_at' => '2022-06-22T18:59:27.577Z',
61
+ 'updated_at' => '2022-06-22T18:59:27.577Z'
62
+ }
63
+ end
64
+
65
+ let(:expected_url) { "https://#{host}/api/courses/4" }
66
+
67
+ before do
68
+ stub_request(:patch, expected_url)
69
+ .with(body: { course: params.slice(:title, :is_blueprint) }.to_json)
70
+ .to_return(
71
+ status: 200,
72
+ body: response.to_json,
73
+ headers: { 'Content-Type' => 'application/json' }
74
+ )
75
+ end
76
+
77
+ it 'pathces to the correct endpoint and returns the response' do
78
+ expect(
79
+ subject.update(params: params, token: 'token').parsed_response
80
+ ).to eq(response)
81
+ end
82
+ end
83
+
45
84
  describe '#destroy' do
46
85
  let(:params) { { canvas_id: 1 } }
47
86
  let(:expected_url) { "https://#{host}/api/courses/1" }
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'pact/consumer/rspec'
2
1
  require 'pry'
3
2
  require 'simplecov'
4
3
  require 'webmock/rspec'
@@ -10,33 +9,10 @@ end
10
9
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
11
10
  require 'quiz_api_client'
12
11
 
13
- Dir[File.dirname(__FILE__) + '/support/*.rb'].each { |f| require f }
14
- Dir[File.dirname(__FILE__) + '/contracts/shared_examples/*.rb'].each { |f| require f }
15
-
16
12
  WebMock.disable_net_connect!(
17
- allow_localhost: true,
18
- allow: [PactConfig.broker_host]
13
+ allow_localhost: true
19
14
  )
20
15
 
21
- # see https://github.com/realestate-com-au/pact/blob/master/documentation/configuration.md
22
- Pact.configure do |config|
23
- config.diff_formatter = :list
24
- config.logger.level = Logger::DEBUG
25
- config.pact_dir = 'pacts'
26
- config.pactfile_write_mode = :overwrite
27
- config.pactfile_write_order = :chronological
28
- end
29
-
30
- Pact.service_consumer PactConfig::QUIZ_API_CLIENT_RUBY do
31
- has_pact_with PactConfig::Providers::QUIZ_API do
32
- mock_service :quiz_api do
33
- port 1234
34
- pact_specification_version '2.0.0'
35
- end
36
- end
37
- end
38
-
39
16
  RSpec.configure do |config|
40
- config.filter_run_excluding :pact
41
17
  config.before { allow_any_instance_of(::Logger).to receive(:info) }
42
18
  end
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.0
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-06-23 00:00:00.000000000 Z
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
@@ -229,29 +201,6 @@ files:
229
201
  - lib/quiz_api_client/services/shared_banks.rb
230
202
  - lib/quiz_api_client/version.rb
231
203
  - spec/config_spec.rb
232
- - spec/contracts/interaction_types_service_spec.rb
233
- - spec/contracts/item_analyses_service_spec.rb
234
- - spec/contracts/items_service_spec.rb
235
- - spec/contracts/qti_imports_service_spec.rb
236
- - spec/contracts/quiz_clone_job_service_spec.rb
237
- - spec/contracts/quiz_clone_jobs_service_spec.rb
238
- - spec/contracts/quiz_entries_service_spec.rb
239
- - spec/contracts/quiz_service_spec.rb
240
- - spec/contracts/quiz_session_events_service_spec.rb
241
- - spec/contracts/quiz_session_result_service_spec.rb
242
- - spec/contracts/quiz_session_service_spec.rb
243
- - spec/contracts/quiz_sessions_service_spec.rb
244
- - spec/contracts/quiz_sync_job_service_spec.rb
245
- - spec/contracts/quiz_sync_jobs_service_spec.rb
246
- - spec/contracts/quizzes_service_spec.rb
247
- - spec/contracts/session_item_results_service_spec.rb
248
- - spec/contracts/session_items_service_spec.rb
249
- - spec/contracts/shared_banks_spec.rb
250
- - spec/contracts/shared_examples/http_delete_example.rb
251
- - spec/contracts/shared_examples/http_get_example.rb
252
- - spec/contracts/shared_examples/http_patch_example.rb
253
- - spec/contracts/shared_examples/http_post_example.rb
254
- - spec/contracts/shared_examples/http_put_example.rb
255
204
  - spec/http_client_spec.rb
256
205
  - spec/json_formatter_spec.rb
257
206
  - spec/quiz_api_client/http_request/failure_spec.rb
@@ -279,8 +228,6 @@ files:
279
228
  - spec/services/session_item_results_service_spec.rb
280
229
  - spec/services/session_items_service_spec.rb
281
230
  - spec/spec_helper.rb
282
- - spec/support/pact_config.rb
283
- - spec/support/pact_helper.rb
284
231
  homepage:
285
232
  licenses: []
286
233
  metadata: {}
@@ -305,29 +252,6 @@ specification_version: 4
305
252
  summary: Ruby client for quiz_api
306
253
  test_files:
307
254
  - spec/config_spec.rb
308
- - spec/contracts/interaction_types_service_spec.rb
309
- - spec/contracts/item_analyses_service_spec.rb
310
- - spec/contracts/items_service_spec.rb
311
- - spec/contracts/qti_imports_service_spec.rb
312
- - spec/contracts/quiz_clone_job_service_spec.rb
313
- - spec/contracts/quiz_clone_jobs_service_spec.rb
314
- - spec/contracts/quiz_entries_service_spec.rb
315
- - spec/contracts/quiz_service_spec.rb
316
- - spec/contracts/quiz_session_events_service_spec.rb
317
- - spec/contracts/quiz_session_result_service_spec.rb
318
- - spec/contracts/quiz_session_service_spec.rb
319
- - spec/contracts/quiz_sessions_service_spec.rb
320
- - spec/contracts/quiz_sync_job_service_spec.rb
321
- - spec/contracts/quiz_sync_jobs_service_spec.rb
322
- - spec/contracts/quizzes_service_spec.rb
323
- - spec/contracts/session_item_results_service_spec.rb
324
- - spec/contracts/session_items_service_spec.rb
325
- - spec/contracts/shared_banks_spec.rb
326
- - spec/contracts/shared_examples/http_delete_example.rb
327
- - spec/contracts/shared_examples/http_get_example.rb
328
- - spec/contracts/shared_examples/http_patch_example.rb
329
- - spec/contracts/shared_examples/http_post_example.rb
330
- - spec/contracts/shared_examples/http_put_example.rb
331
255
  - spec/http_client_spec.rb
332
256
  - spec/json_formatter_spec.rb
333
257
  - spec/quiz_api_client/http_request/failure_spec.rb
@@ -355,5 +279,3 @@ test_files:
355
279
  - spec/services/session_item_results_service_spec.rb
356
280
  - spec/services/session_items_service_spec.rb
357
281
  - spec/spec_helper.rb
358
- - spec/support/pact_config.rb
359
- - 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