apirunner 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
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.6"
8
+ s.version = "0.2.7"
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"]
@@ -10,7 +10,7 @@ staging:
10
10
  namespace: api1v0
11
11
  production:
12
12
  protocol: http
13
- host: www.moviepilot.com
13
+ host: vtu.premium.moviepilot.com
14
14
  port: 80
15
15
  namespace: api1v0
16
16
  general:
@@ -57,12 +57,119 @@
57
57
  response_expectation:
58
58
  status_code: 404
59
59
  body:
60
- - name: "There should return recommendations / ratings for a discovery request for place_keyword:420"
60
+ - name: "There should return recommendations / ratings for a discovery request for place_keyword:200"
61
61
  request:
62
62
  headers:
63
63
  Content-Type: 'application/json'
64
- path: '/users/duffyduck/predictions/discovery/place_keyword:420'
64
+ path: '/users/duffyduck/predictions/discovery/place_keyword:200'
65
65
  method: 'GET'
66
66
  response_expectation:
67
67
  status_code: 200
68
68
  body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
69
+ - name: "There should return exactly 5 recommendations / ratings for a discovery request for place_keyword:200 with per_page 5"
70
+ request:
71
+ headers:
72
+ Content-Type: 'application/json'
73
+ path: '/users/duffyduck/predictions/discovery/place_keyword:200'
74
+ parameters:
75
+ per_page: 5
76
+ method: 'GET'
77
+ response_expectation:
78
+ status_code: 200
79
+ body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
80
+ - name: "There should not return any recommendations / ratings on a dicovery request for place_keyword:200 for a non existing user"
81
+ request:
82
+ headers:
83
+ Content-Type: 'application/json'
84
+ path: '/users/daisyduck/predictions/discovery/place_keyword:200'
85
+ method: 'GET'
86
+ response_expectation:
87
+ status_code: 404
88
+ body:
89
+ - name: "There should return recommendations / ratings for a discovery request for time_keyword:198"
90
+ request:
91
+ headers:
92
+ Content-Type: 'application/json'
93
+ path: '/users/duffyduck/predictions/discovery/time_keyword:198'
94
+ method: 'GET'
95
+ response_expectation:
96
+ status_code: 200
97
+ body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
98
+ - name: "There should return exactly 5 recommendations / ratings for a discovery request for time_keyword:198 with per_page 5"
99
+ request:
100
+ headers:
101
+ Content-Type: 'application/json'
102
+ path: '/users/duffyduck/predictions/discovery/time_keyword:198'
103
+ parameters:
104
+ per_page: 5
105
+ method: 'GET'
106
+ response_expectation:
107
+ status_code: 200
108
+ body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
109
+ - name: "There should not return any recommendations / ratings on a dicovery request for time_keyword:198 for a non existing user"
110
+ request:
111
+ headers:
112
+ Content-Type: 'application/json'
113
+ path: '/users/daisyduck/predictions/discovery/place_keyword:198'
114
+ method: 'GET'
115
+ response_expectation:
116
+ status_code: 404
117
+ body:
118
+ - name: "There should return recommendations / ratings for a discovery request for emotion_keyword:12"
119
+ request:
120
+ headers:
121
+ Content-Type: 'application/json'
122
+ path: '/users/duffyduck/predictions/discovery/emotion_keyword:12'
123
+ method: 'GET'
124
+ response_expectation:
125
+ status_code: 200
126
+ body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
127
+ - name: "There should return exactly 5 recommendations / ratings for a discovery request for emotion_keyword:12 with per_page 5"
128
+ request:
129
+ headers:
130
+ Content-Type: 'application/json'
131
+ path: '/users/duffyduck/predictions/discovery/emotion_keyword:12'
132
+ parameters:
133
+ per_page: 5
134
+ method: 'GET'
135
+ response_expectation:
136
+ status_code: 200
137
+ body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
138
+ - name: "There should not return any recommendations / ratings on a dicovery request for emotion_keyword:12 for a non existing user"
139
+ request:
140
+ headers:
141
+ Content-Type: 'application/json'
142
+ path: '/users/daisyduck/predictions/discovery/emotion_keyword:12'
143
+ method: 'GET'
144
+ response_expectation:
145
+ status_code: 404
146
+ body:
147
+ - name: "There should return recommendations / ratings for a discovery request for intended_audience:13"
148
+ request:
149
+ headers:
150
+ Content-Type: 'application/json'
151
+ path: '/users/duffyduck/predictions/discovery/intended_audience:13'
152
+ method: 'GET'
153
+ response_expectation:
154
+ status_code: 200
155
+ body: /^\[({"m\d+":[0-5]\.[05]},)+{"m\d+":[0-5]\.[05]}\]$/
156
+ - name: "There should return exactly 5 recommendations / ratings for a discovery request for intended_audience:13 with per_page 5"
157
+ request:
158
+ headers:
159
+ Content-Type: 'application/json'
160
+ path: '/users/duffyduck/predictions/discovery/intended_audience:13'
161
+ parameters:
162
+ per_page: 5
163
+ method: 'GET'
164
+ response_expectation:
165
+ status_code: 200
166
+ body: /^\[({"m\d+":[0-5]\.[05]},){4}{"m\d+":[0-5]\.[05]}\]$/
167
+ - name: "There should not return any recommendations / ratings on a dicovery request for intended_audience:13 for a non existing user"
168
+ request:
169
+ headers:
170
+ Content-Type: 'application/json'
171
+ path: '/users/daisyduck/predictions/discovery/intended_audience:13'
172
+ method: 'GET'
173
+ response_expectation:
174
+ status_code: 404
175
+ body:
@@ -1,7 +1,5 @@
1
1
  class ExpectationMatcher
2
2
  require 'result'
3
- require 'nokogiri'
4
- require 'JSON'
5
3
  require 'checker'
6
4
  require 'plugins/response_json_syntax_checker'
7
5
  require 'plugins/response_header_checker'
@@ -1,4 +1,5 @@
1
1
  class ResponseBodyChecker < Checker
2
+ require 'nokogiri'
2
3
 
3
4
  def check
4
5
  result = Result.new(@testcase, @response)
data/lib/result.rb CHANGED
@@ -20,7 +20,7 @@ class Result
20
20
  # yields out rspec like error messages only in case of an error
21
21
  def rspec(index)
22
22
  if not @succeeded
23
- puts "\nError (#{index}) - \"#{@testcase['name']}\""
23
+ puts "\n\033[31mError\033[0m (#{index}) - \"#{@testcase.name}\""
24
24
  puts @error_message
25
25
  end
26
26
  end
@@ -43,7 +43,7 @@ class Result
43
43
 
44
44
  # yields the verbose error messages
45
45
  def be_verbose(index)
46
- puts "\n#{result_case} (#{index+1}) - \"#{@testcase.name}\""
46
+ puts "\n#{result_case} (#{index+1})- \"#{@testcase.name}\""
47
47
  puts @error_message
48
48
  puts(" More more more verbosity\n")
49
49
  puts(" request method: #{@testcase.request['method']}")
@@ -63,9 +63,9 @@ class Result
63
63
  # returns the result case for interpolation in the output message header
64
64
  def result_case
65
65
  if @succeeded
66
- "Success"
66
+ "\033[32mSuccess\033[0m"
67
67
  else
68
- "Error"
68
+ "\033[31mError\033[0m"
69
69
  end
70
70
  end
71
71
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 6
9
- version: 0.2.6
8
+ - 7
9
+ version: 0.2.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - jan@moviepilot.com
@@ -277,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
278
  - - ">="
279
279
  - !ruby/object:Gem::Version
280
- hash: -3493840128367980321
280
+ hash: -704173494687780541
281
281
  segments:
282
282
  - 0
283
283
  version: "0"