apirunner 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/apirunner.gemspec +5 -5
- data/examples/config/api_runner.yml +1 -1
- data/examples/test/api_runner/003_update_ratings.yml +78 -16
- data/examples/test/api_runner/004_rateables_and_pagination.yml +34 -0
- data/examples/test/api_runner/005_recommendations.yml +108 -0
- data/examples/test/api_runner/006_discovery.yml +68 -0
- data/lib/api_runner.rb +1 -0
- metadata +7 -7
- data/examples/test/api_runner/001_create_ressource.yml +0 -131
- data/examples/test/api_runner/005_cache_operations.yml +0 -1
- data/examples/test/api_runner/999_delete_ressource.yml +0 -8
- /data/examples/test/api_runner/{004_pagination.yml → 007_cacheable_operations.yml} +0 -0
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/apirunner.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apirunner}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jan@moviepilot.com"]
|
@@ -28,13 +28,13 @@ Gem::Specification.new do |s|
|
|
28
28
|
"apirunner.gemspec",
|
29
29
|
"changelog.txt",
|
30
30
|
"examples/config/api_runner.yml",
|
31
|
-
"examples/test/api_runner/001_create_ressource.yml",
|
32
31
|
"examples/test/api_runner/001_create_user.yml",
|
33
32
|
"examples/test/api_runner/002_update_resources.yml",
|
34
33
|
"examples/test/api_runner/003_update_ratings.yml",
|
35
|
-
"examples/test/api_runner/
|
36
|
-
"examples/test/api_runner/
|
37
|
-
"examples/test/api_runner/
|
34
|
+
"examples/test/api_runner/004_rateables_and_pagination.yml",
|
35
|
+
"examples/test/api_runner/005_recommendations.yml",
|
36
|
+
"examples/test/api_runner/006_discovery.yml",
|
37
|
+
"examples/test/api_runner/007_cacheable_operations.yml",
|
38
38
|
"examples/test/api_runner/999_delete_user.yml",
|
39
39
|
"examples/test/api_runner/excludes.yml",
|
40
40
|
"features/apirunner.feature",
|
@@ -1,27 +1,89 @@
|
|
1
1
|
---
|
2
|
-
- name: "
|
2
|
+
- name: "One putted rating should be createable with 204 response"
|
3
3
|
request:
|
4
|
-
path: '/users/duffyduck/rateables'
|
5
|
-
method: 'GET'
|
6
4
|
headers:
|
7
|
-
Content-Type:
|
8
|
-
|
5
|
+
Content-Type: 'application/json'
|
6
|
+
path: '/users/duffyduck/ratings'
|
7
|
+
method: 'PUT'
|
8
|
+
body:
|
9
|
+
m765: 1.0
|
10
|
+
response_expectation:
|
11
|
+
status_code: 204
|
12
|
+
body:
|
13
|
+
- name: "There should be exactly one rating in that profile"
|
14
|
+
request:
|
15
|
+
headers:
|
16
|
+
Content-Type: 'application/json'
|
17
|
+
path: '/users/duffyduck'
|
18
|
+
method: 'GET'
|
9
19
|
response_expectation:
|
10
20
|
status_code: 200
|
21
|
+
body:
|
22
|
+
ratings:
|
23
|
+
m765: 1.0
|
24
|
+
- name: "5 putted ratings should be createable with 204 response"
|
25
|
+
request:
|
11
26
|
headers:
|
12
|
-
|
13
|
-
|
14
|
-
|
27
|
+
Content-Type: 'application/json'
|
28
|
+
path: '/users/duffyduck/ratings'
|
29
|
+
method: 'PUT'
|
30
|
+
body:
|
31
|
+
m765: 1.0
|
32
|
+
m42: 2.0
|
33
|
+
m89: 3.0
|
34
|
+
m91: 4.0
|
35
|
+
m98: 5.0
|
36
|
+
response_expectation:
|
37
|
+
status_code: 204
|
38
|
+
body:
|
39
|
+
- name: "There should be exactly 5 ratings in that profile"
|
15
40
|
request:
|
16
|
-
path: '/users/duffyduck/rateables?per_page=10'
|
17
|
-
parameters:
|
18
|
-
per_page: 10
|
19
|
-
method: 'GET'
|
20
41
|
headers:
|
21
|
-
Content-Type:
|
22
|
-
|
42
|
+
Content-Type: 'application/json'
|
43
|
+
path: '/users/duffyduck'
|
44
|
+
method: 'GET'
|
23
45
|
response_expectation:
|
24
46
|
status_code: 200
|
47
|
+
body:
|
48
|
+
ratings:
|
49
|
+
m765: 1.0
|
50
|
+
m42: 2.0
|
51
|
+
m89: 3.0
|
52
|
+
m91: 4.0
|
53
|
+
m98: 5.0
|
54
|
+
- name: "It should return a 404 in case ratings for a non existant user are put"
|
55
|
+
request:
|
25
56
|
headers:
|
26
|
-
|
27
|
-
|
57
|
+
Content-Type: 'application/json'
|
58
|
+
path: '/users/daisyduck/ratings'
|
59
|
+
method: 'PUT'
|
60
|
+
body:
|
61
|
+
m765: 1.0
|
62
|
+
m42: 2.0
|
63
|
+
response_expectation:
|
64
|
+
status_code: 404
|
65
|
+
- name: "It should return a 409 in case ratings are put with ambigous moviemaster_id"
|
66
|
+
request:
|
67
|
+
headers:
|
68
|
+
Content-Type: 'application/json'
|
69
|
+
path: '/users/duffyduck/ratings'
|
70
|
+
method: 'PUT'
|
71
|
+
body:
|
72
|
+
m765000000000000: 1.0
|
73
|
+
m420000000000000: 2.0
|
74
|
+
response_expectation:
|
75
|
+
status_code: 409
|
76
|
+
body:
|
77
|
+
- name: "It should return a 409 in case ratings are put with ambigous ratings values"
|
78
|
+
priority: 1
|
79
|
+
request:
|
80
|
+
headers:
|
81
|
+
Content-Type: 'application/json'
|
82
|
+
path: '/users/duffyduck/ratings'
|
83
|
+
method: 'PUT'
|
84
|
+
body:
|
85
|
+
m765: 6.0
|
86
|
+
m42: -2.0
|
87
|
+
response_expectation:
|
88
|
+
status_code: 409
|
89
|
+
body:
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
- name: "Rateables requested for a non existant user should result in a 404"
|
3
|
+
request:
|
4
|
+
headers:
|
5
|
+
Content-Type: 'application/json'
|
6
|
+
path: '/users/daisyduck/rateables'
|
7
|
+
method: 'GET'
|
8
|
+
response_expectation:
|
9
|
+
status_code: 404
|
10
|
+
body:
|
11
|
+
- name: "Without per_page there should come out 1 rateable movie"
|
12
|
+
request:
|
13
|
+
path: '/users/duffyduck/rateables'
|
14
|
+
method: 'GET'
|
15
|
+
headers:
|
16
|
+
Content-Type: 'application/json'
|
17
|
+
response_expectation:
|
18
|
+
status_code: 200
|
19
|
+
headers:
|
20
|
+
Last-Modified: /.*/
|
21
|
+
body: /^\["m\d+"\]$/
|
22
|
+
- name: "With per_page 10 there should come out 10 rateable movies"
|
23
|
+
request:
|
24
|
+
path: '/users/duffyduck/rateables'
|
25
|
+
parameters:
|
26
|
+
per_page: 10
|
27
|
+
method: 'GET'
|
28
|
+
headers:
|
29
|
+
Content-Type: 'application/json'
|
30
|
+
response_expectation:
|
31
|
+
status_code: 200
|
32
|
+
headers:
|
33
|
+
Last-Modified: /.*/
|
34
|
+
body: /^\[("m\d+",?){10}\]$/
|
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
- name: "9 ratings in preparation for recommendation check should return a 204"
|
3
|
+
request:
|
4
|
+
headers:
|
5
|
+
Content-Type: 'application/json'
|
6
|
+
path: '/users/duffyduck/ratings'
|
7
|
+
method: 'PUT'
|
8
|
+
body:
|
9
|
+
m765: 1.0
|
10
|
+
m42: 2.0
|
11
|
+
m89: 3.0
|
12
|
+
m91: 4.0
|
13
|
+
m98: 5.0
|
14
|
+
m766: 1.0
|
15
|
+
m43: 2.0
|
16
|
+
m90: 3.0
|
17
|
+
m92: 4.0
|
18
|
+
response_expectation:
|
19
|
+
status_code: 204
|
20
|
+
body:
|
21
|
+
- name: "There should not be any recommendations and a 204 because there are too few ratings"
|
22
|
+
priority: 1
|
23
|
+
request:
|
24
|
+
headers:
|
25
|
+
Content-Type: 'application/json'
|
26
|
+
path: '/users/duffyduck/recommendations'
|
27
|
+
method: 'GET'
|
28
|
+
response_expectation:
|
29
|
+
status_code: 204
|
30
|
+
body: {}
|
31
|
+
- name: "There should NOT be a prediction for a certain item"
|
32
|
+
priority: 1
|
33
|
+
request:
|
34
|
+
headers:
|
35
|
+
Content-Type: 'application/json'
|
36
|
+
path: '/users/duffyduck/predictions/items/m965'
|
37
|
+
method: 'GET'
|
38
|
+
response_expectation:
|
39
|
+
status_code: 204
|
40
|
+
body:
|
41
|
+
- name: "10 ratings in preparation for recommendation check should return a 204"
|
42
|
+
request:
|
43
|
+
headers:
|
44
|
+
Content-Type: 'application/json'
|
45
|
+
path: '/users/duffyduck/ratings'
|
46
|
+
method: 'PUT'
|
47
|
+
body:
|
48
|
+
m765: 1.0
|
49
|
+
m42: 2.0
|
50
|
+
m89: 3.0
|
51
|
+
m91: 4.0
|
52
|
+
m98: 5.0
|
53
|
+
m766: 1.0
|
54
|
+
m43: 2.0
|
55
|
+
m90: 3.0
|
56
|
+
m92: 4.0
|
57
|
+
m99: 5.0
|
58
|
+
response_expectation:
|
59
|
+
status_code: 204
|
60
|
+
body:
|
61
|
+
- name: "With 10 ratings put there should be a lot of recommendations"
|
62
|
+
request:
|
63
|
+
headers:
|
64
|
+
Content-Type: 'application/json'
|
65
|
+
path: '/users/duffyduck/recommendations'
|
66
|
+
method: 'GET'
|
67
|
+
response_expectation:
|
68
|
+
status_code: 200
|
69
|
+
body: /^\[(\{"m\d+":[0-5]\.[05]\},)*\{"m\d+":[0-5]\.[05]\}\]$/
|
70
|
+
- name: "There should be only 10 recommendations if per_page parameter is set"
|
71
|
+
priority: 1
|
72
|
+
request:
|
73
|
+
headers:
|
74
|
+
Content-Type: 'application/json'
|
75
|
+
path: '/users/duffyduck/recommendations'
|
76
|
+
method: 'GET'
|
77
|
+
parameters:
|
78
|
+
per_page: 10
|
79
|
+
response_expectation:
|
80
|
+
status_code: 200
|
81
|
+
body: /^\[(\{"m\d+":[0-5]\.[05]\},){9}\{"m\d+":[0-5]\.[05]\}\]$/
|
82
|
+
- name: "There should occure a 404 if recommendations are requested for a non existing user"
|
83
|
+
request:
|
84
|
+
headers:
|
85
|
+
Content-Type: 'application/json'
|
86
|
+
path: '/users/daisyduck/recommendations'
|
87
|
+
method: 'GET'
|
88
|
+
response_expectation:
|
89
|
+
status_code: 404
|
90
|
+
body:
|
91
|
+
- name: "There should be a prediction for a certain item"
|
92
|
+
request:
|
93
|
+
headers:
|
94
|
+
Content-Type: 'application/json'
|
95
|
+
path: '/users/duffyduck/predictions/items/m965'
|
96
|
+
method: 'GET'
|
97
|
+
response_expectation:
|
98
|
+
status_code: 200
|
99
|
+
body: /^\[{"m\d+":[0-5]\.[05]}\]$/
|
100
|
+
- name: "There should occure a 404 if a prediction for y certain item is requested for an unknown user"
|
101
|
+
request:
|
102
|
+
headers:
|
103
|
+
Content-Type: 'application/json'
|
104
|
+
path: '/users/daisyduck/predictions/items/m965'
|
105
|
+
method: 'GET'
|
106
|
+
response_expectation:
|
107
|
+
status_code: 404
|
108
|
+
body:
|
@@ -0,0 +1,68 @@
|
|
1
|
+
---
|
2
|
+
- name: "There should return recommendations / ratings for a discovery request for genre:20"
|
3
|
+
request:
|
4
|
+
headers:
|
5
|
+
Content-Type: 'application/json'
|
6
|
+
path: '/users/duffyduck/predictions/discovery/genre:20'
|
7
|
+
method: 'GET'
|
8
|
+
response_expectation:
|
9
|
+
status_code: 200
|
10
|
+
body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
|
11
|
+
- name: "There should return exatctly 5 recommendations / ratings for a discovery request for genre:20 with per_page 5"
|
12
|
+
request:
|
13
|
+
headers:
|
14
|
+
Content-Type: 'application/json'
|
15
|
+
path: '/users/duffyduck/predictions/discovery/genre:20'
|
16
|
+
parameters:
|
17
|
+
per_page: 5
|
18
|
+
method: 'GET'
|
19
|
+
response_expectation:
|
20
|
+
status_code: 200
|
21
|
+
body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
|
22
|
+
- name: "There should not return any recommendations / ratings on a dicovery request for genre:20 for a non existing user"
|
23
|
+
request:
|
24
|
+
headers:
|
25
|
+
Content-Type: 'application/json'
|
26
|
+
path: '/users/daisyduck/predictions/discovery/genre:20'
|
27
|
+
method: 'GET'
|
28
|
+
response_expectation:
|
29
|
+
status_code: 404
|
30
|
+
body:
|
31
|
+
- name: "There should return recommendations / ratings for a discovery request for plot_keyword:2"
|
32
|
+
request:
|
33
|
+
headers:
|
34
|
+
Content-Type: 'application/json'
|
35
|
+
path: '/users/duffyduck/predictions/discovery/plot_keyword:2'
|
36
|
+
method: 'GET'
|
37
|
+
response_expectation:
|
38
|
+
status_code: 200
|
39
|
+
body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
|
40
|
+
- name: "There should return exactly 5 recommendations / ratings for a discovery request for plot_keyword:2 with per_page 5"
|
41
|
+
request:
|
42
|
+
headers:
|
43
|
+
Content-Type: 'application/json'
|
44
|
+
path: '/users/duffyduck/predictions/discovery/plot_keyword:2'
|
45
|
+
parameters:
|
46
|
+
per_page: 5
|
47
|
+
method: 'GET'
|
48
|
+
response_expectation:
|
49
|
+
status_code: 200
|
50
|
+
body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
|
51
|
+
- name: "There should not return any recommendations / ratings on a dicovery request for plot_keyword:2 for a non existing user"
|
52
|
+
request:
|
53
|
+
headers:
|
54
|
+
Content-Type: 'application/json'
|
55
|
+
path: '/users/daisyduck/predictions/discovery/plot_keyword:2'
|
56
|
+
method: 'GET'
|
57
|
+
response_expectation:
|
58
|
+
status_code: 404
|
59
|
+
body:
|
60
|
+
- name: "There should return recommendations / ratings for a discovery request for place_keyword:420"
|
61
|
+
request:
|
62
|
+
headers:
|
63
|
+
Content-Type: 'application/json'
|
64
|
+
path: '/users/duffyduck/predictions/discovery/place_keyword:420'
|
65
|
+
method: 'GET'
|
66
|
+
response_expectation:
|
67
|
+
status_code: 200
|
68
|
+
body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
|
data/lib/api_runner.rb
CHANGED
@@ -37,6 +37,7 @@ class ApiRunner
|
|
37
37
|
|
38
38
|
# runs all testcases that are provided by the testclass an fills errors if there are any
|
39
39
|
def run_tests
|
40
|
+
puts "Running exactly #{@spec.size} tests."
|
40
41
|
@spec.each do |test_case|
|
41
42
|
response = send_request(test_case['request']['method'].downcase.to_sym, test_case['request']['path'], test_case['request']['headers'], test_case['request']['body'], test_case['request']['parameters'])
|
42
43
|
@expectation.test_types.each do |test_type|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- jan@moviepilot.com
|
@@ -232,13 +232,13 @@ files:
|
|
232
232
|
- apirunner.gemspec
|
233
233
|
- changelog.txt
|
234
234
|
- examples/config/api_runner.yml
|
235
|
-
- examples/test/api_runner/001_create_ressource.yml
|
236
235
|
- examples/test/api_runner/001_create_user.yml
|
237
236
|
- examples/test/api_runner/002_update_resources.yml
|
238
237
|
- examples/test/api_runner/003_update_ratings.yml
|
239
|
-
- examples/test/api_runner/
|
240
|
-
- examples/test/api_runner/
|
241
|
-
- examples/test/api_runner/
|
238
|
+
- examples/test/api_runner/004_rateables_and_pagination.yml
|
239
|
+
- examples/test/api_runner/005_recommendations.yml
|
240
|
+
- examples/test/api_runner/006_discovery.yml
|
241
|
+
- examples/test/api_runner/007_cacheable_operations.yml
|
242
242
|
- examples/test/api_runner/999_delete_user.yml
|
243
243
|
- examples/test/api_runner/excludes.yml
|
244
244
|
- features/apirunner.feature
|
@@ -271,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
271
|
requirements:
|
272
272
|
- - ">="
|
273
273
|
- !ruby/object:Gem::Version
|
274
|
-
hash:
|
274
|
+
hash: 3550102861078407058
|
275
275
|
segments:
|
276
276
|
- 0
|
277
277
|
version: "0"
|
@@ -1,131 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- name: 'Create new User'
|
3
|
-
request:
|
4
|
-
headers:
|
5
|
-
Content-Type: 'application/json'
|
6
|
-
path: '/users/duffyduck'
|
7
|
-
method: 'PUT'
|
8
|
-
body:
|
9
|
-
username: 'duffyduck'
|
10
|
-
watchlist:
|
11
|
-
- m333
|
12
|
-
- m79
|
13
|
-
blacklist:
|
14
|
-
- m334
|
15
|
-
- m77
|
16
|
-
skiplist:
|
17
|
-
- m335
|
18
|
-
- m78
|
19
|
-
ratings:
|
20
|
-
m336: 4
|
21
|
-
m79: 2.5
|
22
|
-
m777: 3.0
|
23
|
-
m567: 4.0
|
24
|
-
m354: 5.0
|
25
|
-
expires_at: 2011-09-09T22:41:50+00:00
|
26
|
-
response_expectation:
|
27
|
-
status_code: 201
|
28
|
-
headers:
|
29
|
-
Last-Modified: /.*/
|
30
|
-
body:
|
31
|
-
username: 'duffyduck'
|
32
|
-
watchlist:
|
33
|
-
- m333
|
34
|
-
- m79
|
35
|
-
blacklist:
|
36
|
-
- m334
|
37
|
-
- m77
|
38
|
-
skiplist:
|
39
|
-
- m335
|
40
|
-
- m78
|
41
|
-
ratings:
|
42
|
-
m336: 4.0
|
43
|
-
m79: 2.5
|
44
|
-
fsk: "18"
|
45
|
-
- name: 'Update existing User - Update watchlist'
|
46
|
-
request:
|
47
|
-
headers:
|
48
|
-
Content-Type: 'application/json'
|
49
|
-
path: '/users/duffyduck/watchlist'
|
50
|
-
method: 'PUT'
|
51
|
-
body:
|
52
|
-
- m367
|
53
|
-
- m73
|
54
|
-
response_expectation:
|
55
|
-
status_code: 204
|
56
|
-
body:
|
57
|
-
- name: 'Check User FSK,Watchlist'
|
58
|
-
request:
|
59
|
-
headers:
|
60
|
-
Content-Type: 'application/json'
|
61
|
-
path: '/users/duffyduck'
|
62
|
-
method: 'GET'
|
63
|
-
response_expectation:
|
64
|
-
status_code: 200
|
65
|
-
headers:
|
66
|
-
Last-Modified: /.*/
|
67
|
-
body:
|
68
|
-
username: 'duffyduck'
|
69
|
-
fsk: "18"
|
70
|
-
watchlist:
|
71
|
-
- m367
|
72
|
-
- m73
|
73
|
-
blacklist:
|
74
|
-
- m334
|
75
|
-
- m77
|
76
|
-
skiplist:
|
77
|
-
- m335
|
78
|
-
- m78
|
79
|
-
ratings:
|
80
|
-
m336: 4.0
|
81
|
-
m79: 2.5
|
82
|
-
- name: 'Set 10 Ratings'
|
83
|
-
request:
|
84
|
-
headers:
|
85
|
-
Content-Type: 'application/json'
|
86
|
-
path: '/users/duffyduck/ratings'
|
87
|
-
method: 'PUT'
|
88
|
-
body:
|
89
|
-
"m1035": 1
|
90
|
-
"m2087": 0.5
|
91
|
-
"m1554": 2
|
92
|
-
"m2981": 1.0
|
93
|
-
"m1590": 2
|
94
|
-
"m12493": 4
|
95
|
-
"m1875": 5
|
96
|
-
"m7258": 2.5
|
97
|
-
response_expectation:
|
98
|
-
status_code: 204
|
99
|
-
headers:
|
100
|
-
Last-Modified: /.*/
|
101
|
-
- name: 'Check User Ratings Update'
|
102
|
-
request:
|
103
|
-
headers:
|
104
|
-
Content-Type: 'application/json'
|
105
|
-
path: '/users/duffyduck'
|
106
|
-
method: 'GET'
|
107
|
-
response_expectation:
|
108
|
-
status_code: 200
|
109
|
-
headers:
|
110
|
-
Last-Modified: /.*/
|
111
|
-
body:
|
112
|
-
username: 'duffyduck'
|
113
|
-
fsk: "18"
|
114
|
-
watchlist:
|
115
|
-
- m367
|
116
|
-
- m73
|
117
|
-
blacklist:
|
118
|
-
- m334
|
119
|
-
- m77
|
120
|
-
skiplist:
|
121
|
-
- m335
|
122
|
-
- m78
|
123
|
-
ratings:
|
124
|
-
"m1035": "1.0"
|
125
|
-
"m2087": "0.5"
|
126
|
-
"m1554": "2.0"
|
127
|
-
"m2981": "1.0"
|
128
|
-
"m1590": "2.0"
|
129
|
-
"m12493": "4.0"
|
130
|
-
"m1875": "5.0"
|
131
|
-
"m7258": "2.5"
|
@@ -1 +0,0 @@
|
|
1
|
-
---
|
File without changes
|