canvas_oauth_engine 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas_oauth.rb +1 -0
- data/lib/canvas_oauth/canvas_api.rb +1 -1
- data/lib/canvas_oauth/default_utf8_parser.rb +13 -0
- data/lib/canvas_oauth/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1 -0
- data/spec/dummy/log/test.log +1114 -0
- data/spec/lib/canvas_oauth/canvas_api_spec.rb +7 -0
- data/spec/lib/canvas_oauth/default_utf8_parser_spec.rb +21 -0
- metadata +27 -5
@@ -271,6 +271,13 @@ describe CanvasOauth::CanvasApi do
|
|
271
271
|
expect(canvas).to receive(:authenticated_get).exactly(3).times.and_return(created, running, aborted)
|
272
272
|
canvas.get_report(1, :provisioning_csv, params)
|
273
273
|
end
|
274
|
+
|
275
|
+
it "uses the default UTF 8 parser it its get call" do
|
276
|
+
allow(canvas).to receive(:authenticated_get).and_return(complete)
|
277
|
+
expect(canvas).to receive(:authenticated_post).with("/api/v1/accounts/1/reports/provisioning_csv", { body: params })
|
278
|
+
expect(CanvasOauth::CanvasApi).to receive(:get).with(file['url'], hash_including(parser: CanvasOauth::DefaultUTF8Parser)).and_return(response)
|
279
|
+
canvas.get_report(1, :provisioning_csv, params)
|
280
|
+
end
|
274
281
|
end
|
275
282
|
end
|
276
283
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CanvasOauth::DefaultUTF8Parser do
|
4
|
+
describe "#parse" do
|
5
|
+
it "forces the body passed in to UTF-8 if it is ASCII_8BIT" do
|
6
|
+
body = String.new("I am some text", encoding: Encoding::ASCII_8BIT)
|
7
|
+
|
8
|
+
parser = CanvasOauth::DefaultUTF8Parser.new(body, "text/plain")
|
9
|
+
expect(body).to receive(:force_encoding).with("UTF-8")
|
10
|
+
parser.parse
|
11
|
+
end
|
12
|
+
|
13
|
+
it "does not force the body passed in to UTF-8 if not ASCII_8BIT" do
|
14
|
+
body = String.new("I am some text", encoding: Encoding::US_ASCII)
|
15
|
+
|
16
|
+
parser = CanvasOauth::DefaultUTF8Parser.new(body, "text/plain")
|
17
|
+
expect(body).not_to receive(:force_encoding)
|
18
|
+
parser.parse
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_oauth_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Donahue
|
8
8
|
- Adam Anderson
|
9
9
|
- Simon Williams
|
10
|
+
- Keith Garner
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rails
|
@@ -38,14 +39,14 @@ dependencies:
|
|
38
39
|
requirements:
|
39
40
|
- - ">="
|
40
41
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
42
|
+
version: 0.17.0
|
42
43
|
type: :runtime
|
43
44
|
prerelease: false
|
44
45
|
version_requirements: !ruby/object:Gem::Requirement
|
45
46
|
requirements:
|
46
47
|
- - ">="
|
47
48
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
49
|
+
version: 0.17.0
|
49
50
|
- !ruby/object:Gem::Dependency
|
50
51
|
name: link_header
|
51
52
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,6 +187,20 @@ dependencies:
|
|
186
187
|
- - "~>"
|
187
188
|
- !ruby/object:Gem::Version
|
188
189
|
version: 3.0.6
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: sprockets
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - "~>"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '3.0'
|
197
|
+
type: :development
|
198
|
+
prerelease: false
|
199
|
+
version_requirements: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - "~>"
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '3.0'
|
189
204
|
- !ruby/object:Gem::Dependency
|
190
205
|
name: rb-fsevent
|
191
206
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,8 +231,8 @@ dependencies:
|
|
216
231
|
version: '0'
|
217
232
|
description:
|
218
233
|
email:
|
219
|
-
- adam.anderson@12spokes.com
|
220
234
|
- simon@instructure.com
|
235
|
+
- kgarner@instructure.com
|
221
236
|
executables: []
|
222
237
|
extensions: []
|
223
238
|
extra_rdoc_files: []
|
@@ -237,6 +252,7 @@ files:
|
|
237
252
|
- lib/canvas_oauth/canvas_application.rb
|
238
253
|
- lib/canvas_oauth/canvas_config.rb
|
239
254
|
- lib/canvas_oauth/config.rb
|
255
|
+
- lib/canvas_oauth/default_utf8_parser.rb
|
240
256
|
- lib/canvas_oauth/engine.rb
|
241
257
|
- lib/canvas_oauth/version.rb
|
242
258
|
- lib/tasks/canvas_oauth_tasks.rake
|
@@ -262,9 +278,11 @@ files:
|
|
262
278
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
263
279
|
- spec/dummy/config/locales/en.yml
|
264
280
|
- spec/dummy/config/routes.rb
|
281
|
+
- spec/dummy/db/development.sqlite3
|
265
282
|
- spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
|
266
283
|
- spec/dummy/db/schema.rb
|
267
284
|
- spec/dummy/db/test.sqlite3
|
285
|
+
- spec/dummy/log/development.log
|
268
286
|
- spec/dummy/log/test.log
|
269
287
|
- spec/dummy/public/404.html
|
270
288
|
- spec/dummy/public/422.html
|
@@ -274,6 +292,7 @@ files:
|
|
274
292
|
- spec/dummy/script/rails
|
275
293
|
- spec/lib/canvas_oauth/canvas_api_extensions_spec.rb
|
276
294
|
- spec/lib/canvas_oauth/canvas_api_spec.rb
|
295
|
+
- spec/lib/canvas_oauth/default_utf8_parser_spec.rb
|
277
296
|
- spec/models/canvas_oauth/authorization_spec.rb
|
278
297
|
- spec/spec_helper.rb
|
279
298
|
homepage: ''
|
@@ -331,9 +350,12 @@ test_files:
|
|
331
350
|
- spec/dummy/db/schema.rb
|
332
351
|
- spec/dummy/db/test.sqlite3
|
333
352
|
- spec/dummy/db/migrate/20160711200737_create_canvas_oauth_authorizations.canvas_oauth.rb
|
353
|
+
- spec/dummy/db/development.sqlite3
|
334
354
|
- spec/dummy/log/test.log
|
355
|
+
- spec/dummy/log/development.log
|
335
356
|
- spec/dummy/README.rdoc
|
336
357
|
- spec/models/canvas_oauth/authorization_spec.rb
|
337
358
|
- spec/lib/canvas_oauth/canvas_api_extensions_spec.rb
|
359
|
+
- spec/lib/canvas_oauth/default_utf8_parser_spec.rb
|
338
360
|
- spec/lib/canvas_oauth/canvas_api_spec.rb
|
339
361
|
- spec/controllers/canvas_oauth/canvas_controller_spec.rb
|