beaker-http 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 126ad20369072bad14cd0f1c540ebf2c5c09c8c8
4
- data.tar.gz: 627779ca603f73a147d893dd8fef723b48082d28
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NGNhNjA5MTRjN2M5MmMxMzdiN2U3NWMzMzY1YWY2MTQ4N2FmNWUxOA==
5
+ data.tar.gz: !binary |-
6
+ ZjM1MDBjZDc3ZGNiYzllY2ZmZjJhZTQyZjY0ZDVkMzJkN2RkYzgwZg==
5
7
  SHA512:
6
- metadata.gz: 149ac40c2ad28e4dd28d96cd27dfa0661b94018f1735139712ed655c969c179a8e0589339d7dc13f1c3ce137949eba67e98fe304185b829e356487fd291ccb85
7
- data.tar.gz: da4fac3b62401bbabe3400c336701e76329dc2bb700fb5f802d1be66f38bdcdc93dd41839b2919a4eb37a429b403ebac4d4fec74ce0db9c7ef1cec76c7f65272
8
+ metadata.gz: !binary |-
9
+ YWM1YThkZThhNDdkMDdhOTZiZWRkMDc5ZmE1M2ZiNjVjNGIzMGNlN2Y5ZDdl
10
+ YzdmZGVlZGJmYTZkM2QxMTZlMjBlZTQzMWU2ZDNkOTA5MTk1OGFjZjk3NjY2
11
+ NDQ5NDQ3OGM4ZGI5ZjE5YzRjMmQ3MmIxYTdmNzU3MzIzYjAwYTY=
12
+ data.tar.gz: !binary |-
13
+ OWI2MDgyMzUyYzA4ZGE3YTkyY2ZlODg0OTc1MDE0NTNmOGIzNWI2NzE0ZGE1
14
+ ZWVkYWQxYjBlZWY2MDIwZDEzYTdjOTFlOWU5YzA0MmEyOTdkZDFkODZjMDgy
15
+ ZWU2Y2ZmZGFlYWI3MmViYmFmNWM0OGQ3MDBkOTQwYWIzYWNiNzI=
data/HISTORY.md ADDED
@@ -0,0 +1,8 @@
1
+ # default - History
2
+ ## Tags
3
+ * [LATEST - 9 Dec, 2016 (81e072fa)](#LATEST)
4
+
5
+ ## Details
6
+ ### <a name = "LATEST">LATEST - 9 Dec, 2016 (81e072fa)
7
+
8
+ * Initial release.
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # beaker-http
2
2
 
3
- This library is designed to assist in test scenarios where http requests to a Beaker::Host
4
- are required. It utilizes the Faraday library to generate requests, and the [Http](lib/beaker-http/http.rb)
5
- class is designed to be subclassed into objects that are more targeted to specific http
6
- services running on beaker hosts.
3
+ This library adds the ability to send http traffic from the beaker coordinator itself,
4
+ reducing the need to use beaker's DSL method `on` as an interface to `curl` on a
5
+ SUT(System Under Test). It utilizes the Faraday library to generate requests, and the
6
+ [Connection](lib/beaker-http/http.rb) class in the `Beaker::Http` module is the class
7
+ you want to use directly, either utilizing it directly or subclassing it to build your
8
+ own Connection class.
9
+
10
+ Please use the DSL methods included in this library [here](lib/beaker-http/dsl/web_helpers.rb).
11
+ Reference the [rubydocs](http://www.rubydoc.info/github/puppetlabs/beaker-http/master/Beaker/DSL/Helpers/WebHelpers) for more information on how to use these methods.
12
+
7
13
 
8
14
  ## spec testing
9
15
 
@@ -13,5 +19,8 @@ by running `bundle exec rake test:spec:run` or using the `test:spec` task.
13
19
 
14
20
  ## acceptance testing
15
21
 
16
- Acceptance testing will be added once the first few releases have been released.
22
+ The acceptance folder currently contains [one acceptance test](acceptance/tests/puppetserver_requests.rb)
23
+ that demonstrates how to use this in a beaker test; as we refine this module and solidify the
24
+ API, more thorough acceptance testing will be coming. For now, please use that test as an example
25
+ of how to use this library.
17
26
 
@@ -33,6 +33,11 @@ module Beaker
33
33
  headers.map { |k, v| "#{k}: #{v.inspect}" }.join("\n")
34
34
  end
35
35
 
36
+ def pretty_inspect(body)
37
+ require 'pp' unless body.respond_to?(:pretty_inspect)
38
+ body.pretty_inspect
39
+ end
40
+
36
41
  def dump_body(body)
37
42
  if body.respond_to?(:to_str)
38
43
  body.to_str
@@ -1,7 +1,7 @@
1
1
  module Beaker
2
2
  module Http
3
3
  module Version
4
- STRING = '0.0.1'
4
+ STRING = '0.1.0'
5
5
  end
6
6
  end
7
7
  end
@@ -46,4 +46,26 @@ describe Beaker::Http::FaradayBeakerLogger do
46
46
  conn.post() { |connection| connection.body = "BODY MOVIN'" }
47
47
  end
48
48
  end
49
+
50
+ context 'when body responses do not respond to :to_str' do
51
+ let (:array_response) { [1, 2, 3] }
52
+ before do
53
+ conn.builder.insert(0, Beaker::Http::FaradayBeakerLogger, logger, :bodies => true)
54
+ conn.adapter :test do |stub|
55
+ stub.post('/path') {[201, {}, array_response]}
56
+ end
57
+ end
58
+
59
+ it 'calls pretty print for that response' do
60
+ expect_any_instance_of(Beaker::Http::FaradayBeakerLogger).to receive(:pretty_inspect).with(array_response).once.and_call_original
61
+ expect(logger).to receive(:info).with('POST: http://test.com/path').once
62
+ expect(logger).to receive(:info).with(/RESPONSE CODE: 201/).once
63
+ expect(logger).to receive(:debug).with(/ELAPSED TIME:/).once
64
+ expect(logger).to receive(:debug).with("RESPONSE BODY:\n[1, 2, 3]\n").once
65
+ expect(logger).to receive(:debug).with(/REQUEST BODY:\nBODY MOVIN'/).once
66
+ expect(logger).to receive(:debug).with(/REQUEST HEADERS:/).once
67
+ expect(logger).to receive(:debug).with(/RESPONSE HEADERS:/).once
68
+ conn.post() { |connection| connection.body = "BODY MOVIN'" }
69
+ end
70
+ end
49
71
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.12
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.9.12
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yard
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: markdown
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
@@ -112,62 +112,62 @@ dependencies:
112
112
  name: json
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.8'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '1.8'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: beaker
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: '3.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: faraday
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0.9'
146
- - - ">="
146
+ - - ! '>='
147
147
  - !ruby/object:Gem::Version
148
148
  version: 0.9.1
149
149
  type: :runtime
150
150
  prerelease: false
151
151
  version_requirements: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - "~>"
153
+ - - ~>
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0.9'
156
- - - ">="
156
+ - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.9.1
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: faraday_middleware
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - "~>"
163
+ - - ~>
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0.9'
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - "~>"
170
+ - - ~>
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0.9'
173
173
  description: Puppet testing tool coupled with Beaker
@@ -178,6 +178,7 @@ extensions: []
178
178
  extra_rdoc_files: []
179
179
  files:
180
180
  - Gemfile
181
+ - HISTORY.md
181
182
  - README.md
182
183
  - Rakefile
183
184
  - acceptance/tests/puppetserver_requests.rb
@@ -201,17 +202,17 @@ require_paths:
201
202
  - lib
202
203
  required_ruby_version: !ruby/object:Gem::Requirement
203
204
  requirements:
204
- - - ">="
205
+ - - ! '>='
205
206
  - !ruby/object:Gem::Version
206
207
  version: '0'
207
208
  required_rubygems_version: !ruby/object:Gem::Requirement
208
209
  requirements:
209
- - - ">="
210
+ - - ! '>='
210
211
  - !ruby/object:Gem::Version
211
212
  version: '0'
212
213
  requirements: []
213
214
  rubyforge_project:
214
- rubygems_version: 2.5.1
215
+ rubygems_version: 2.4.6
215
216
  signing_key:
216
217
  specification_version: 4
217
218
  summary: Puppet testing tool
@@ -220,4 +221,3 @@ test_files:
220
221
  - spec/beaker-http/http_spec.rb
221
222
  - spec/beaker-http/middleware/response/faraday_beaker_logger_spec.rb
222
223
  - spec/spec_helper.rb
223
- has_rdoc: