Skip to content

Commit

Permalink
[CDRIS-4761] Data Quality Report - Remove manual update and necessary…
Browse files Browse the repository at this point in the history
… infrastructure
  • Loading branch information
Logan Stahl committed Jul 2, 2019
1 parent d9756ed commit e707822
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
12 changes: 1 addition & 11 deletions lib/cdris/gateway/data_quality_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@ module Gateway
class DataQualityReport < Cdris::Gateway::Requestor
private_class_method :new
class << self

# Update the data quality report
# Create a new one if there is no existing report
# @param [Hash] options specify query values
# @return [Hash] CDRIS response
def create_or_update(options = {})
path = "#{api}/reports/data-quality/summary/generate"
request(path, options.merge!(method: :post)).
if_400_raise(Cdris::Gateway::Exceptions::BadRequestError.new()).to_hash
end


# Get the summary of data quality
# @param [Hash] options specify query values
# @return [Hash] CDRIS response
Expand Down
35 changes: 0 additions & 35 deletions spec/cdris/gateway/data_quality_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,6 @@
Cdris::Api::Client.config = TestConfig.to_hash
end

describe 'self.create_or_update' do

let(:path) { '/api/v1/reports/data-quality/summary/generate' }
let(:response_message) { { 'message'=>'The system is updating the report' } }

before(:each) do
FakeWeb.register_uri(
:post,
'http://testhost:4242/api/v1/reports/data-quality/summary/generate?user%5Bextension%5D=spameggs&user%5Broot%5D=foobar',
body: response_message.to_json , status: ['200', 'OK'])
end

it 'performs a post request' do
expect(Cdris::Gateway::Requestor).to receive(:request).with(path, { method: :post }).and_call_original
expect(described_class.create_or_update).to eq(response_message)
end

context 'when the server returns a 400 error' do

before(:each) do
FakeWeb.register_uri(
:post,
'http://testhost:4242/api/v1/reports/data-quality/summary/generate?user%5Bextension%5D=spameggs&user%5Broot%5D=foobar',
body: 'Bad Request', status: ['400', 'Bad Request'])
end

it 'raises a bad request error' do
expect(Cdris::Gateway::Requestor).to receive(:request).with(path, { method: :post }).and_call_original
expect { described_class.create_or_update }.to raise_error(Cdris::Gateway::Exceptions::BadRequestError)
end

end

end

describe 'self.summary' do

let(:path) { '/api/v1/reports/data-quality/summary' }
Expand Down

0 comments on commit e707822

Please sign in to comment.