test_server 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/application_controller.rb +5 -0
- data/app/controllers/javascript_controller.rb +2 -2
- data/app/controllers/streaming_controller.rb +3 -3
- data/app/controllers/string_controller.rb +5 -5
- data/app/views/{application.haml → layouts/application.haml} +0 -0
- data/lib/test_server/version.rb +1 -1
- data/lib/test_server.rb +1 -0
- data/spec/features/fetch_data_via_javascript_spec.rb +1 -2
- data/spec/features/fetch_test_data_plain_spec.rb +3 -3
- data/spec/features/fetch_test_data_via_streaming_spec.rb +3 -3
- data/test_server.gemspec +1 -0
- metadata +19 -3
@@ -5,8 +5,13 @@ module TestServer
|
|
5
5
|
set :root, ::File.expand_path('../../', __FILE__)
|
6
6
|
set :haml, :format => :html5
|
7
7
|
|
8
|
+
enable :protect_from_csrf
|
8
9
|
enable :protection
|
9
10
|
enable :session
|
11
|
+
enable :report_csrf_failure
|
12
|
+
|
13
|
+
register Padrino::Helpers
|
14
|
+
register Padrino::Routing
|
10
15
|
|
11
16
|
use Rack::Deflater
|
12
17
|
use Rack::Locale
|
@@ -18,7 +18,7 @@ module TestServer
|
|
18
18
|
configure_caching(params)
|
19
19
|
end
|
20
20
|
|
21
|
-
get '/xhr/url
|
21
|
+
get :url, map: '/xhr/url' do
|
22
22
|
param :count, Integer, default: 10
|
23
23
|
param :timeout, Integer, default: 10
|
24
24
|
param :url, String
|
@@ -29,7 +29,7 @@ module TestServer
|
|
29
29
|
@timeout = params[:timeout]
|
30
30
|
@repeat = %w{ on yes true t }.include?(params[:repeat])
|
31
31
|
|
32
|
-
|
32
|
+
render 'xhr/show', layout: :application
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -21,11 +21,11 @@ module TestServer
|
|
21
21
|
mime_type :stream, 'text/plain'
|
22
22
|
end
|
23
23
|
|
24
|
-
get '/' do
|
24
|
+
get :index, map: '/' do
|
25
25
|
redirect to('/default/')
|
26
26
|
end
|
27
27
|
|
28
|
-
get '/default
|
28
|
+
get :string, map: '/default' do
|
29
29
|
param :count, Integer, default: 10
|
30
30
|
|
31
31
|
count = params[:count]
|
@@ -40,7 +40,7 @@ module TestServer
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
get '/eicar
|
43
|
+
get :eicar, map: '/eicar' do
|
44
44
|
stream_data do |out|
|
45
45
|
generate_eicar.each do |c|
|
46
46
|
out << encode { c }
|
@@ -12,11 +12,11 @@ module TestServer
|
|
12
12
|
configure_caching(params)
|
13
13
|
end
|
14
14
|
|
15
|
-
get '/' do
|
15
|
+
get :index, map: '/' do
|
16
16
|
redirect to('/default/')
|
17
17
|
end
|
18
18
|
|
19
|
-
get '/default
|
19
|
+
get :string, map: '/default' do
|
20
20
|
param :count, Integer, default: 1
|
21
21
|
|
22
22
|
encode do
|
@@ -24,13 +24,13 @@ module TestServer
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
get '/eicar
|
27
|
+
get :eicar, map: '/eicar' do
|
28
28
|
encode do
|
29
29
|
generate_eicar.join
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
get '/sleep
|
33
|
+
get :sleep, map: '/sleep' do
|
34
34
|
param :count, Integer, default: 120
|
35
35
|
sleep params[:count]
|
36
36
|
|
@@ -39,7 +39,7 @@ module TestServer
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
get '/random
|
42
|
+
get :random, map: '/random' do
|
43
43
|
param :count, Integer, default: 10
|
44
44
|
|
45
45
|
encode do
|
File without changes
|
data/lib/test_server/version.rb
CHANGED
data/lib/test_server.rb
CHANGED
@@ -47,7 +47,7 @@ describe 'Fetch data via javascript', :js do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
|
50
|
-
click_button('
|
50
|
+
click_button('start')
|
51
51
|
|
52
52
|
first '.ts-result-row'
|
53
53
|
|
@@ -74,6 +74,5 @@ describe 'Fetch data via javascript', :js do
|
|
74
74
|
expect(find('#repeat').checked?).to be true
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
78
77
|
end
|
79
78
|
end
|
@@ -23,7 +23,7 @@ describe 'Fetch plain data' do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'downloads the data with multiplier' do
|
26
|
-
visit('/default
|
26
|
+
visit('/default?count=10')
|
27
27
|
|
28
28
|
expect(page.status_code).to eq 200
|
29
29
|
expect(page.source.split(/\n/).size).to eq 10
|
@@ -78,7 +78,7 @@ describe 'Fetch plain data' do
|
|
78
78
|
|
79
79
|
it 'supports long running requests' do
|
80
80
|
timeout(3) do
|
81
|
-
visit('/sleep
|
81
|
+
visit('/sleep?count=2')
|
82
82
|
end
|
83
83
|
|
84
84
|
expect(page.status_code).to eq 200
|
@@ -86,7 +86,7 @@ describe 'Fetch plain data' do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'supports random string' do
|
89
|
-
visit('/random
|
89
|
+
visit('/random?count=2')
|
90
90
|
|
91
91
|
expect(page.status_code).to eq 200
|
92
92
|
expect(page.source.size).to eq 2
|
@@ -17,21 +17,21 @@ describe 'Fetch Test Data via Streaming' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'downloads stream' do
|
20
|
-
visit('/default
|
20
|
+
visit('/default?count=2')
|
21
21
|
|
22
22
|
expect(page.status_code).to be 200
|
23
23
|
expect(page).to have_content('data')
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'supports base64 encoding' do
|
27
|
-
visit('/default
|
27
|
+
visit('/default?count=2&base64')
|
28
28
|
|
29
29
|
expect(page.status_code).to be 200
|
30
30
|
expect(Base64.decode64(page.source.split(/\n/).last)).to include 'data'
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'supports gzip encoding' do
|
34
|
-
visit('/default
|
34
|
+
visit('/default?count=2&gzip')
|
35
35
|
|
36
36
|
expect(page.status_code).to be 200
|
37
37
|
expect(Base64.decode64(page.source.split(/\n/).last)).to include "\xC6\xC2\bODLT\x91\xCC \xC32\xC7tG \x85q\xDD\x11\xC8".force_encoding('ASCII-8bit')
|
data/test_server.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -347,6 +347,22 @@ dependencies:
|
|
347
347
|
- - ! '>='
|
348
348
|
- !ruby/object:Gem::Version
|
349
349
|
version: '0'
|
350
|
+
- !ruby/object:Gem::Dependency
|
351
|
+
name: padrino
|
352
|
+
requirement: !ruby/object:Gem::Requirement
|
353
|
+
none: false
|
354
|
+
requirements:
|
355
|
+
- - ! '>='
|
356
|
+
- !ruby/object:Gem::Version
|
357
|
+
version: '0'
|
358
|
+
type: :runtime
|
359
|
+
prerelease: false
|
360
|
+
version_requirements: !ruby/object:Gem::Requirement
|
361
|
+
none: false
|
362
|
+
requirements:
|
363
|
+
- - ! '>='
|
364
|
+
- !ruby/object:Gem::Version
|
365
|
+
version: '0'
|
350
366
|
description: Test server for proxies
|
351
367
|
email:
|
352
368
|
- dg1@vrnetze.de
|
@@ -374,7 +390,7 @@ files:
|
|
374
390
|
- app/controllers/javascript_controller.rb
|
375
391
|
- app/controllers/streaming_controller.rb
|
376
392
|
- app/controllers/string_controller.rb
|
377
|
-
- app/views/application.haml
|
393
|
+
- app/views/layouts/application.haml
|
378
394
|
- app/views/xhr/show.haml
|
379
395
|
- bin/test_server
|
380
396
|
- bower.json
|