OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Provide NotImplemented error message for bitmaps
Oliver Günther27fadc1b60b1
diff --git a/lib/api/errors/not_implemented.rb b/lib/api/errors/not_implemented.rbnew file mode 100644index 00000000000..31d6059c9f2--- /dev/null+++ b/lib/api/errors/not_implemented.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+enddiff --git a/lib/api/root_api.rb b/lib/api/root_api.rbindex f6828f69ac1..db54b30da32 100644--- a/lib/api/root_api.rb+++ b/lib/api/root_api.rb@@ -211,6 +211,7 @@ module APIerror_response ActiveRecord::RecordNotFound, ::API::Errors::NotFound, log: falseerror_response ActiveRecord::StaleObjectError, ::API::Errors::Conflict, log: false+ error_response NotImplementedError, ::API::Errors::NotImplemented, log: falseerror_response MultiJson::ParseError, ::API::Errors::ParseErrordiff --git a/modules/bcf/app/controllers/bcf/api/v2_1/viewpoints_api.rb b/modules/bcf/app/controllers/bcf/api/v2_1/viewpoints_api.rbindex 493c95b1f38..e6ff51c3388 100644--- a/modules/bcf/app/controllers/bcf/api/v2_1/viewpoints_api.rb+++ b/modules/bcf/app/controllers/bcf/api/v2_1/viewpoints_api.rb@@ -58,6 +58,12 @@ module Bcf::API::V2_1endendend++ namespace :bitmaps do+ get do+ raise NotImplementedError, 'Bitmaps are not yet implemented.'+ end+ endendendenddiff --git a/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb b/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rbindex bf22d087bc7..44bbd1a759f 100644--- a/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb+++ b/modules/bcf/spec/requests/api/bcf/v2_1/shared_responses.rb@@ -105,3 +105,16 @@ shared_examples_for 'bcf api unprocessable response' do.to eql 'application/json; charset=utf-8'endend++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+enddiff --git a/modules/bcf/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb b/modules/bcf/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rbindex 6c3699c3b67..32ddfe2426d 100644--- a/modules/bcf/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb+++ b/modules/bcf/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb@@ -131,4 +131,18 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, witit_behaves_like 'bcf api not found response'endend++ 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+ endend