|
178 | 178 | end
|
179 | 179 |
|
180 | 180 | it "falls back to the next supported format", if: Puppet.features.pson? do
|
| 181 | + Puppet[:allow_pson_serialization] = true |
181 | 182 | data = Puppet::IndirectorTesting.new("my data")
|
182 | 183 | indirection.save(data, "my data")
|
183 | 184 | request = a_request_that_finds(data, :accept_header => "application/json, text/pson")
|
|
211 | 212 | }.to raise_error(not_found_error)
|
212 | 213 | end
|
213 | 214 |
|
214 |
| - it "should raise FormatError if tries to fallback and pson serialization is not allowed" do |
215 |
| - Puppet[:allow_pson_serialization] = false |
| 215 | + it "should raise FormatError if tries to fallback" do |
216 | 216 | data = Puppet::IndirectorTesting.new("my data")
|
217 | 217 | indirection.save(data, "my data")
|
218 | 218 | request = a_request_that_finds(data, :accept_header => "unknown, text/pson")
|
|
239 | 239 | end
|
240 | 240 |
|
241 | 241 | it "falls back to the next supported format", if: Puppet.features.pson? do
|
| 242 | + Puppet[:allow_pson_serialization] = true |
242 | 243 | data = Puppet::IndirectorTesting.new("my data")
|
243 | 244 | indirection.save(data, "my data")
|
244 | 245 | request = a_request_that_searches(Puppet::IndirectorTesting.new("my"), :accept_header => "application/json, text/pson")
|
|
254 | 255 | it "raises 406 not acceptable if no formats are accceptable" do
|
255 | 256 | data = Puppet::IndirectorTesting.new("my data")
|
256 | 257 | indirection.save(data, "my data")
|
257 |
| - request = a_request_that_searches(Puppet::IndirectorTesting.new("my"), :accept_header => "application/json") |
258 |
| - allow(data).to receive(:to_json).and_raise(Puppet::Network::FormatHandler::FormatError, 'Could not render to Puppet::Network::Format[json]: source sequence is illegal/malformed utf-8') |
| 258 | + request = a_request_that_searches(Puppet::IndirectorTesting.new("my"), :accept_header => "unknown") |
259 | 259 |
|
260 | 260 | expect {
|
261 | 261 | handler.call(request, response)
|
262 | 262 | }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAcceptableError,
|
263 |
| - %r{No supported formats are acceptable \(Accept: application/json\)}) |
| 263 | + %r{No supported formats are acceptable \(Accept: unknown\)}) |
264 | 264 | end
|
265 | 265 |
|
266 |
| - it "raises FormatError if tries to fallback and pson serialization is not allowed" do |
267 |
| - Puppet[:allow_pson_serialization] = false |
| 266 | + it "raises FormatError if tries to fallback" do |
268 | 267 | data = Puppet::IndirectorTesting.new("my data")
|
269 | 268 | indirection.save(data, "my data")
|
270 | 269 | request = a_request_that_searches(Puppet::IndirectorTesting.new("my"), :accept_header => "unknown, text/pson")
|
|
0 commit comments