Provide NotImplemented error message for bitmaps

pull/7895/head
Oliver Günther 5 years ago
parent 64b4f3fb9f
commit 27fadc1b60
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 41
      lib/api/errors/not_implemented.rb
  2. 1
      lib/api/root_api.rb
  3. 6
      modules/bcf/app/controllers/bcf/api/v2_1/viewpoints_api.rb
  4. 13
      modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb
  5. 14
      modules/bcf/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb

@ -0,0 +1,41 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See docs/COPYRIGHT.rdoc for more details.
#++
module API
module Errors
class NotImplemented < ErrorBase
identifier 'urn:openproject-org:api:v3:errors:NotImplemented'.freeze
code 501
def initialize(error_message = 'Not yet implemented'.freeze)
super error_message
end
end
end
end

@ -211,6 +211,7 @@ module API
error_response ActiveRecord::RecordNotFound, ::API::Errors::NotFound, log: false
error_response ActiveRecord::StaleObjectError, ::API::Errors::Conflict, log: false
error_response NotImplementedError, ::API::Errors::NotImplemented, log: false
error_response MultiJson::ParseError, ::API::Errors::ParseError

@ -58,6 +58,12 @@ module Bcf::API::V2_1
end
end
end
namespace :bitmaps do
get do
raise NotImplementedError, 'Bitmaps are not yet implemented.'
end
end
end
end
end

@ -105,3 +105,16 @@ shared_examples_for 'bcf api unprocessable response' do
.to eql 'application/json; charset=utf-8'
end
end
shared_examples_for 'bcf api not implemented response' do
it 'responds 501 not implemented', :aggregate_failures do
expect(subject.status).to eql 501
expected = {
message: expected_message
}
expect(subject.body).to be_json_eql(expected.to_json)
expect(subject.headers['Content-Type']).to eql 'application/json; charset=utf-8'
end
end

@ -131,4 +131,18 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
it_behaves_like 'bcf api not found response'
end
end
describe 'GET /api/bcf/2.1/projects/:project_id/topics/:uuid/viewpoints/:uuid/bitmaps' do
let(:path) { "/api/bcf/2.1/projects/#{project.id}/topics/#{bcf_issue.uuid}/viewpoints/#{viewpoint.uuid}/bitmaps" }
let(:current_user) { view_only_user }
before do
login_as(current_user)
get path
end
it_behaves_like 'bcf api not implemented response' do
let(:expected_message) { 'Bitmaps are not yet implemented.' }
end
end
end

Loading…
Cancel
Save