22
33# Test the OctocatalogDiff::PuppetDB library
44require_relative 'spec_helper'
5+ require OctocatalogDiff ::Spec . require_path ( '/errors' )
56require OctocatalogDiff ::Spec . require_path ( '/puppetdb' )
67require 'uri'
78
@@ -174,7 +175,7 @@ def ssl_test(server_opts, opts = {})
174175 puppetdb_url : 'http://127.0.0.1:1'
175176 }
176177 testobj = OctocatalogDiff ::PuppetDB . new ( opts )
177- expect { testobj . get ( '/foo' ) } . to raise_error ( OctocatalogDiff ::PuppetDB :: ConnectionError )
178+ expect { testobj . get ( '/foo' ) } . to raise_error ( OctocatalogDiff ::Errors :: PuppetDBConnectionError )
178179 end
179180
180181 it 'should timeout correctly' do
@@ -187,7 +188,7 @@ def ssl_test(server_opts, opts = {})
187188 }
188189 testobj = OctocatalogDiff ::PuppetDB . new ( opts )
189190 time_begin = Time . now . to_i
190- expect { testobj . get ( '/foo' ) } . to raise_error ( OctocatalogDiff ::PuppetDB :: ConnectionError )
191+ expect { testobj . get ( '/foo' ) } . to raise_error ( OctocatalogDiff ::Errors :: PuppetDBConnectionError )
191192 time_end = Time . now . to_i
192193 expect ( time_end - time_begin ) . to be <= 5
193194 end
@@ -463,17 +464,17 @@ def ssl_test(server_opts, opts = {})
463464
464465 it 'should handle 404 responses' do
465466 allow ( OctocatalogDiff ::Util ::HTTParty ) . to receive ( :get ) . and_return ( code : 404 , error : 'oh noez' )
466- expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::PuppetDB :: NotFoundError , /oh noez/ )
467+ expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::Errors :: PuppetDBNodeNotFoundError , /oh noez/ )
467468 end
468469
469470 it 'should handle !=200, !=404 responses' do
470471 allow ( OctocatalogDiff ::Util ::HTTParty ) . to receive ( :get ) . and_return ( code : 499 , error : 'oh noez' )
471- expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::PuppetDB :: PuppetDBError , /oh noez/ )
472+ expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::Errors :: PuppetDBGenericError , /oh noez/ )
472473 end
473474
474475 it 'should handle responses with :error' do
475476 allow ( OctocatalogDiff ::Util ::HTTParty ) . to receive ( :get ) . and_return ( code : 200 , error : 'oh noez' )
476- expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::PuppetDB :: PuppetDBError , /500 - oh noez/ )
477+ expect { @testobj . send ( :get , '/foo' ) } . to raise_error ( OctocatalogDiff ::Errors :: PuppetDBGenericError , /500 - oh noez/ )
477478 end
478479
479480 it 'should handle unparseable responses' do
0 commit comments