lib/fog/aws/requests/dns/get_change.rb in fog-aws-0.1.0 vs lib/fog/aws/requests/dns/get_change.rb in fog-aws-0.1.1

- old
+ new

@@ -33,26 +33,21 @@ class Mock def get_change(change_id) response = Excon::Response.new # find the record with matching change_id # records = data[:zones].values.map{|z| z[:records].values.map{|r| r.values}}.flatten - change = self.data[:changes][change_id] + change = self.data[:changes][change_id] || + raise(Fog::DNS::AWS::NotFound.new("NoSuchChange => Could not find resource with ID: #{change_id}")) - if change - response.status = 200 - submitted_at = Time.parse(change[:submitted_at]) - response.body = { - 'Id' => change[:id], - # set as insync after some time - 'Status' => (submitted_at + Fog::Mock.delay) < Time.now ? 'INSYNC' : change[:status], - 'SubmittedAt' => change[:submitted_at] - } - response - else - response.status = 404 - response.body = "<?xml version=\"1.0\"?><ErrorResponse xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\"><Error><Type>Sender</Type><Code>NoSuchChange</Code><Message>Could not find resource with ID: #{change_id}</Message></Error><RequestId>#{Fog::AWS::Mock.request_id}</RequestId></ErrorResponse>" - raise(Excon::Errors.status_error({:expects => 200}, response)) - end + response.status = 200 + submitted_at = Time.parse(change[:submitted_at]) + response.body = { + 'Id' => change[:id], + # set as insync after some time + 'Status' => (submitted_at + Fog::Mock.delay) < Time.now ? 'INSYNC' : change[:status], + 'SubmittedAt' => change[:submitted_at] + } + response end end end end end