From fb36d9e93c8d572956c39678b9978ef071387552 Mon Sep 17 00:00:00 2001 From: Victor Pereira Date: Fri, 30 Nov 2018 12:08:33 +0100 Subject: [PATCH 1/2] Move project_controller (meta and save_meta) to its own controller --- .../controllers/webui/project_controller.rb | 51 +---- .../webui/projects/meta_controller.rb | 71 +++++++ .../app/views/webui/project/_tabs.html.erb | 4 +- src/api/app/views/webui/project/show.html.erb | 2 +- .../meta/show.html.erb} | 4 +- .../webui/project/_breadcrumb_items.html.haml | 3 - .../projects/meta/_breadcrumb_items.html.haml | 3 + .../meta/show.html.haml} | 0 src/api/config/routes.rb | 7 +- .../1_44_1.yml | 157 ++++++++++++++ .../GET_maintained_projects/1_47_1.yml | 196 +++++++++++++++++ .../GET_maintained_projects/1_47_2.yml | 196 +++++++++++++++++ .../without_results/1_38_1_4_2_1.yml | 155 ++++++++++++++ .../Can_load_project_config/1_33_1_1.yml | 114 ++++++++++ .../Can_load_project_config/1_33_1_2.yml | 114 ++++++++++ .../1_30_1_1_1.yml | 124 +++++++++++ .../1_30_1_1_2.yml | 124 +++++++++++ .../1_30_1_1_3.yml | 124 +++++++++++ .../adding_an_invalid_project/1_30_1_2_1.yml | 77 +++++++ .../adding_an_invalid_project/1_30_1_2_2.yml | 77 +++++++ .../adding_an_invalid_project/1_30_1_2_3.yml | 77 +++++++ .../1_30_2_1.yml | 77 +++++++ .../1_30_2_2.yml | 77 +++++++ .../1_29_2_1.yml | 157 ++++++++++++++ .../1_29_1_1_1.yml | 198 ++++++++++++++++++ .../1_29_1_1_2.yml | 198 ++++++++++++++++++ .../1_29_1_1_3.yml | 198 ++++++++++++++++++ .../1_29_1_2_1.yml | 77 +++++++ .../1_29_1_2_2.yml | 77 +++++++ .../can_save_a_project_config/1_34_1_1.yml | 108 ++++++++++ .../can_save_a_project_config/1_34_1_2.yml | 108 ++++++++++ .../GET_meta/1_1_1.yml | 44 ++++ .../1_2_2_4_1.yml | 44 ++++ .../1_2_2_4_2.yml | 44 ++++ .../with_a_valid_meta/1_2_2_3_1.yml | 83 ++++++++ .../with_a_valid_meta/1_2_2_3_2.yml | 83 ++++++++ .../1_2_2_2_1.yml | 44 ++++ .../1_2_2_2_2.yml | 44 ++++ .../without_a_valid_meta/1_2_2_1_1.yml | 44 ++++ .../without_a_valid_meta/1_2_2_1_2.yml | 44 ++++ .../with_an_nonexistent_project/1_2_1_1.yml | 44 ++++ .../webui/project_controller_spec.rb | 72 ------- .../webui/projects/meta_controller_spec.rb | 76 +++++++ 43 files changed, 3491 insertions(+), 130 deletions(-) create mode 100644 src/api/app/controllers/webui/projects/meta_controller.rb rename src/api/app/views/webui/{project/meta.html.erb => projects/meta/show.html.erb} (73%) create mode 100644 src/api/app/views/webui2/webui/projects/meta/_breadcrumb_items.html.haml rename src/api/app/views/webui2/webui/{project/meta.html.haml => projects/meta/show.html.haml} (100%) create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_add_maintained_project_dialog/1_44_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_monitor/with_a_project/with_buildresult/without_results/1_38_1_4_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_3.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_3.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/_remove_maintained_project_fails_without_maintenance_kind_for_a_valid_maintained_project/1_29_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_3.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_2.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_2.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/GET_meta/1_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_1.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_2.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_1.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_2.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_1.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_2.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_1.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_2.yml create mode 100644 src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_an_nonexistent_project/1_2_1_1.yml create mode 100644 src/api/spec/controllers/webui/projects/meta_controller_spec.rb diff --git a/src/api/app/controllers/webui/project_controller.rb b/src/api/app/controllers/webui/project_controller.rb index e5eafbd7ac2..e733341c417 100644 --- a/src/api/app/controllers/webui/project_controller.rb +++ b/src/api/app/controllers/webui/project_controller.rb @@ -14,7 +14,7 @@ class Webui::ProjectController < Webui::WebuiController :new_package, :new_package_branch, :incident_request_dialog, :release_request_dialog, :show, :linking_projects, :add_person, :add_group, :buildresult, :delete_dialog, :destroy, :remove_path_from_target, :rebuild_time, :packages_simple, - :requests, :save, :monitor, :toggle_watch, :meta, + :requests, :save, :monitor, :toggle_watch, :prjconf, :edit, :edit_comment, :status, :maintained_projects, :add_maintained_project_dialog, :add_maintained_project, :remove_maintained_project, @@ -22,7 +22,7 @@ class Webui::ProjectController < Webui::WebuiController :move_path, :save_prjconf, :clear_failed_comment, :pulse] # TODO: check if get_by_name or set_by_name is used for save_prjconf - before_action :set_project_by_name, only: [:save_meta, :save_prjconf] + before_action :set_project_by_name, only: [:save_prjconf] before_action :set_project_by_id, only: [:update] @@ -39,7 +39,7 @@ class Webui::ProjectController < Webui::WebuiController before_action :set_maintained_project, only: [:remove_maintained_project] - after_action :verify_authorized, only: [:save_new, :new_incident, :save_meta] + after_action :verify_authorized, only: [:save_new, :new_incident] def index @show_all = (params[:show_all].to_s == 'true') @@ -503,51 +503,6 @@ def toggle_watch end end - def meta - @meta = @project.render_xml - switch_to_webui2 - end - - def save_meta - authorize @project, :update? - - errors = [] - begin - Suse::Validator.validate('project', params[:meta]) - request_data = Xmlhash.parse(params[:meta]) - - remove_repositories = @project.get_removed_repositories(request_data) - errors << Project.check_repositories(remove_repositories)[:error] - errors << Project.validate_remote_permissions(request_data)[:error] - errors << Project.validate_link_xml_attribute(request_data, @project.name)[:error] - errors << Project.validate_maintenance_xml_attribute(request_data)[:error] - errors << Project.validate_repository_xml_attribute(request_data, @project.name)[:error] - - errors = errors.compact - - if errors.empty? - Project.transaction do - errors << @project.update_from_xml(request_data)[:error] - errors = errors.compact - @project.store if errors.empty? - end - end - rescue Suse::ValidationError => exception - errors << exception.message - end - - status = if errors.empty? - flash.now[:success] = 'Config successfully saved!' - 200 - else - flash.now[:error] = errors.compact.join("\n") - 400 - end - switch_to_webui2 - namespace = switch_to_webui2? ? 'webui2' : 'webui' - render layout: false, status: status, partial: "layouts/#{namespace}/flash", object: flash - end - def prjconf sliced_params = params.slice(:rev) sliced_params.permit! diff --git a/src/api/app/controllers/webui/projects/meta_controller.rb b/src/api/app/controllers/webui/projects/meta_controller.rb new file mode 100644 index 00000000000..69909e7150f --- /dev/null +++ b/src/api/app/controllers/webui/projects/meta_controller.rb @@ -0,0 +1,71 @@ +module Webui + module Projects + class MetaController < WebuiController + require_dependency 'opensuse/validator' + before_action :set_project, only: [:show] + before_action :set_project_by_name, only: [:update] + before_action :validate_meta, only: [:update], unless: -> { !params[:meta] } + after_action :verify_authorized, only: [:update] + + def show + @meta = @project.render_xml + switch_to_webui2 + end + + def update + authorize @project, :update? + errors = [] + errors = validate_request_and_set_error(errors) + errors = run_update(errors) if errors.empty? + status = if errors.empty? + flash.now[:success] = 'Config successfully saved!' + 200 + else + flash.now[:error] = errors.compact.join("\n") + 400 + end + switch_to_webui2 + render layout: false, status: status, partial: "layouts/#{view_namespace}/flash", object: flash + end + + private + + def validate_meta + Suse::Validator.validate('project', params[:meta]) + @request_data = Xmlhash.parse(params[:meta]) + rescue Suse::ValidationError => exception + flash.now[:error] = exception.message + render layout: false, status: 400, partial: "layouts/#{view_namespace}/flash", object: flash + end + + def view_namespace + switch_to_webui2? ? 'webui2' : 'webui' + end + + def validate_request_and_set_error(errors) + remove_repositories = @project.get_removed_repositories(@request_data) + errors << Project.check_repositories(remove_repositories)[:error] + errors << Project.validate_remote_permissions(@request_data)[:error] + errors << Project.validate_link_xml_attribute(@request_data, @project.name)[:error] + errors << Project.validate_maintenance_xml_attribute(@request_data)[:error] + errors << Project.validate_repository_xml_attribute(@request_data, @project.name)[:error] + errors.compact + end + + def run_update(errors) + Project.transaction do + errors << @project.update_from_xml(@request_data)[:error] + errors = errors.compact + @project.store if errors.empty? + end + errors.compact + end + + def set_project_by_name + @project = Project.get_by_name(params[:project]) + rescue Project::UnknownObjectError + @project = nil + end + end + end +end diff --git a/src/api/app/views/webui/project/_tabs.html.erb b/src/api/app/views/webui/project/_tabs.html.erb index 9f3c829509d..49bc0363d29 100644 --- a/src/api/app/views/webui/project/_tabs.html.erb +++ b/src/api/app/views/webui/project/_tabs.html.erb @@ -22,7 +22,7 @@ <%= tab 'users', 'Users', :controller => '/webui/project', :action => :users unless @project.defines_remote_instance? %> <%= tab 'subprojects', 'Subprojects', :controller => '/webui/project', :action => :subprojects unless @project.defines_remote_instance? || @is_maintenance_project %> <% end -%> - + <% if is_advanced_tab? %> <%= content_for :ready_function do %> $("#advanced_tabs").show(); @@ -36,7 +36,7 @@ <%= tab 'projectconfig', 'Project Config', :controller => '/webui/project', :action => :prjconf unless @project.defines_remote_instance? || @is_maintenance_project %> <% unless @spider_bot -%> <%= tab 'attribute', 'Attributes', :controller => '/webui/attribute', :project => @project, :action => 'index' %> - <%= tab 'meta', "Meta", :controller => '/webui/project', :action => :meta %> + <%= tab 'meta', "Meta", :controller => '/webui/projects/meta', :action => :show %> <%= tab 'status', 'Status', :controller => '/webui/project', :action => :status unless @project.defines_remote_instance? || @is_maintenance_project %> <%= tab 'pulse', 'Pulse', :controller => '/webui/project', :action => :pulse %> <% end -%> diff --git a/src/api/app/views/webui/project/show.html.erb b/src/api/app/views/webui/project/show.html.erb index 430ddb9a718..344c9e3b2f6 100644 --- a/src/api/app/views/webui/project/show.html.erb +++ b/src/api/app/views/webui/project/show.html.erb @@ -71,7 +71,7 @@ <% if @releasetargets.length > 0 %>
  • <%= sprite_tag 'information' %> - <%= link_to pluralize(@releasetargets.length, "Release Target"), action: 'meta', project: @project %> + <%= link_to pluralize(@releasetargets.length, "Release Target"), project_meta_path(project: @project) %>
  • <% end %> <% end %> diff --git a/src/api/app/views/webui/project/meta.html.erb b/src/api/app/views/webui/projects/meta/show.html.erb similarity index 73% rename from src/api/app/views/webui/project/meta.html.erb rename to src/api/app/views/webui/projects/meta/show.html.erb index 06d2f8dc8a6..ac7f0ace6a3 100644 --- a/src/api/app/views/webui/project/meta.html.erb +++ b/src/api/app/views/webui/projects/meta/show.html.erb @@ -4,11 +4,11 @@ <% @metarobots = 'noindex' %> <% project_bread_crumb('Meta') %> -<%= render :partial => 'tabs' %> +<%= render :partial => 'webui/project/tabs' %>

    <%= @pagetitle %>

    <% if User.current.can_modify?(@project) %> - <%= render partial: "shared/editor", locals: {text: @meta, mode: 'xml', save: {url: url_for(controller: 'project', action: 'save_meta'), method: 'POST', data: {project: @project.name, submit: 'meta'}}} %> + <%= render partial: "shared/editor", locals: {text: @meta, mode: 'xml', save: {url: project_save_meta_path(@project), method: 'POST', data: {project: @project.name, submit: 'meta'}}} %> <% else %> <%= render partial: "shared/editor", locals: {text: @meta, mode: 'xml', style: {read_only: true}} %> <% end %> diff --git a/src/api/app/views/webui2/webui/project/_breadcrumb_items.html.haml b/src/api/app/views/webui2/webui/project/_breadcrumb_items.html.haml index bfbe2793818..33c19a54d83 100644 --- a/src/api/app/views/webui2/webui/project/_breadcrumb_items.html.haml +++ b/src/api/app/views/webui2/webui/project/_breadcrumb_items.html.haml @@ -19,6 +19,3 @@ - elsif current_page?(project_config_path(@project)) %li.breadcrumb-item.active{ 'aria-current' => 'page' } Configuration - - elsif current_page?(project_meta_path(@project)) - %li.breadcrumb-item.active{ 'aria-current' => 'page' } - Meta diff --git a/src/api/app/views/webui2/webui/projects/meta/_breadcrumb_items.html.haml b/src/api/app/views/webui2/webui/projects/meta/_breadcrumb_items.html.haml new file mode 100644 index 00000000000..b306a3923c6 --- /dev/null +++ b/src/api/app/views/webui2/webui/projects/meta/_breadcrumb_items.html.haml @@ -0,0 +1,3 @@ += render partial: 'webui/project/breadcrumb_items' +%li.breadcrumb-item.active{ 'aria-current' => 'page' } + Meta diff --git a/src/api/app/views/webui2/webui/project/meta.html.haml b/src/api/app/views/webui2/webui/projects/meta/show.html.haml similarity index 100% rename from src/api/app/views/webui2/webui/project/meta.html.haml rename to src/api/app/views/webui2/webui/projects/meta/show.html.haml diff --git a/src/api/config/routes.rb b/src/api/config/routes.rb index 9b308101dfd..0cbcd57b8c8 100644 --- a/src/api/config/routes.rb +++ b/src/api/config/routes.rb @@ -231,6 +231,11 @@ def self.public_or_about_path?(request) end end + controller 'webui/projects/meta' do + get 'project/meta/:project' => :show, constraints: cons, as: 'project_meta' + post 'project/save_meta/:project' => :update, constraints: cons, as: :project_save_meta + end + controller 'webui/project' do get 'project/' => :index, as: 'projects' get 'project/list_public' => :index @@ -280,8 +285,6 @@ def self.public_or_about_path?(request) get 'project/package_buildresult/:project' => :package_buildresult, constraints: cons # TODO: this should be POST (and the link AJAX) get 'project/toggle_watch/:project' => :toggle_watch, constraints: cons, as: 'project_toggle_watch' - get 'project/meta/:project' => :meta, constraints: cons, as: 'project_meta' - post 'project/save_meta/:project' => :save_meta, constraints: cons, as: :project_save_meta get 'project/prjconf/:project' => :prjconf, constraints: cons, as: :project_config post 'project/save_prjconf/:project' => :save_prjconf, constraints: cons, as: :save_project_config get 'project/clear_failed_comment/:project' => :clear_failed_comment, constraints: cons diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_add_maintained_project_dialog/1_44_1.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_add_maintained_project_dialog/1_44_1.yml new file mode 100644 index 00000000000..8398ffb32a1 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_add_maintained_project_dialog/1_44_1.yml @@ -0,0 +1,157 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: put + uri: http://backend:5352/source/MyProject/_meta?user=tom + body: + encoding: UTF-8 + string: | + + Postern of Fate + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '120' + body: + encoding: UTF-8 + string: | + + Postern of Fate + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: put + uri: http://backend:5352/source/MyProject/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '165' + body: + encoding: UTF-8 + string: | + + e3e42cb2687d84ac3e47836a225c1b3f + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: get + uri: http://backend:5352/build/MyProject/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_1.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_1.yml new file mode 100644 index 00000000000..c2a16fac970 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_1.yml @@ -0,0 +1,196 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:12:38 GMT +- request: + method: put + uri: http://backend:5352/source/Project1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + The Road Less Traveled + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '126' + body: + encoding: UTF-8 + string: | + + The Road Less Traveled + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:12:38 GMT +- request: + method: put + uri: http://backend:5352/source/Project1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '165' + body: + encoding: UTF-8 + string: | + + ff50b52f4d833ac8165a8a20b39ec04c + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:12:38 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + A Farewell to Arms + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '104' + body: + encoding: UTF-8 + string: | + + A Farewell to Arms + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:12:38 GMT +- request: + method: get + uri: http://backend:5352/build/Project1/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:12:38 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_2.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_2.yml new file mode 100644 index 00000000000..72ae7f8c045 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_maintained_projects/1_47_2.yml @@ -0,0 +1,196 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:13:04 GMT +- request: + method: put + uri: http://backend:5352/source/Project1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + The Waste Land + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '118' + body: + encoding: UTF-8 + string: | + + The Waste Land + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:13:04 GMT +- request: + method: put + uri: http://backend:5352/source/Project1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '165' + body: + encoding: UTF-8 + string: | + + 4b748d74ff48133b29e0a006983bd57b + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:13:04 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + In a Dry Season + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '101' + body: + encoding: UTF-8 + string: | + + In a Dry Season + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:13:04 GMT +- request: + method: get + uri: http://backend:5352/build/Project1/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:13:04 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_monitor/with_a_project/with_buildresult/without_results/1_38_1_4_2_1.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_monitor/with_a_project/with_buildresult/without_results/1_38_1_4_2_1.yml new file mode 100644 index 00000000000..40e1a644eec --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_monitor/with_a_project/with_buildresult/without_results/1_38_1_4_2_1.yml @@ -0,0 +1,155 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/package_1/_meta?user=_nobody_ + body: + encoding: UTF-8 + string: | + + The Moving Toyshop + Est debitis rerum laboriosam. + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '152' + body: + encoding: UTF-8 + string: | + + The Moving Toyshop + Est debitis rerum laboriosam. + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/package_1/_meta?user=_nobody_ + body: + encoding: UTF-8 + string: | + + The Moving Toyshop + Est debitis rerum laboriosam. + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '152' + body: + encoding: UTF-8 + string: | + + The Moving Toyshop + Est debitis rerum laboriosam. + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=deleting&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_1.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_1.yml new file mode 100644 index 00000000000..d2485bcd1a6 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_1.yml @@ -0,0 +1,114 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: put + uri: http://backend:5352/source/Apache/_meta?user=tom + body: + encoding: UTF-8 + string: | + + A Farewell to Arms + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '101' + body: + encoding: UTF-8 + string: | + + A Farewell to Arms + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: get + uri: http://backend:5352/source/Apache/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '0' + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_2.yml b/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_2.yml new file mode 100644 index 00000000000..ebcb69828b7 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/GET_prjconf/Can_load_project_config/1_33_1_2.yml @@ -0,0 +1,114 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: put + uri: http://backend:5352/source/Apache/_meta?user=tom + body: + encoding: UTF-8 + string: | + + The Doors of Perception + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '106' + body: + encoding: UTF-8 + string: | + + The Doors of Perception + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +- request: + method: get + uri: http://backend:5352/source/Apache/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '0' + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:22 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_1.yml new file mode 100644 index 00000000000..6c1d970a131 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_1.yml @@ -0,0 +1,124 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + <maintenance> + <maintains project="home:tom"/> + </maintenance> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '218' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_2.yml new file mode 100644 index 00000000000..d5e0212842d --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_2.yml @@ -0,0 +1,124 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + <maintenance> + <maintains project="home:tom"/> + </maintenance> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '218' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_3.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_3.yml new file mode 100644 index 00000000000..d5e0212842d --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_a_valid_maintained_project/1_30_1_1_3.yml @@ -0,0 +1,124 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + <maintenance> + <maintains project="home:tom"/> + </maintenance> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '218' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:19 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_1.yml new file mode 100644 index 00000000000..55d3604afe2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_1.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_2.yml new file mode 100644 index 00000000000..55d3604afe2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_2.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_3.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_3.yml new file mode 100644 index 00000000000..55d3604afe2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/with_a_maintenance_project_kind_maintenance_/adding_an_invalid_project/1_30_1_2_3.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_1.yml new file mode 100644 index 00000000000..55d3604afe2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_1.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_2.yml new file mode 100644 index 00000000000..55d3604afe2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_add_maintained_project/without_a_maintenance_project_kind_maintenance_/1_30_2_2.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/_remove_maintained_project_fails_without_maintenance_kind_for_a_valid_maintained_project/1_29_2_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/_remove_maintained_project_fails_without_maintenance_kind_for_a_valid_maintained_project/1_29_2_1.yml new file mode 100644 index 00000000000..03c1600ee2a --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/_remove_maintained_project_fails_without_maintenance_kind_for_a_valid_maintained_project/1_29_2_1.yml @@ -0,0 +1,157 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + If I Forget Thee Jerusalem + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '131' + body: + encoding: UTF-8 + string: | + + If I Forget Thee Jerusalem + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '166' + body: + encoding: UTF-8 + string: | + + 0c051e186c2c50b6fc612af349216d09 + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_1.yml new file mode 100644 index 00000000000..e599a33d94e --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_1.yml @@ -0,0 +1,198 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:14:48 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + The Soldier's Art + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '122' + body: + encoding: UTF-8 + string: | + + The Soldier's Art + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:14:48 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '166' + body: + encoding: UTF-8 + string: | + + 019c8c923a37ffd6673c6530762d354b + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:14:48 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:14:48 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '148' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:14:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_2.yml new file mode 100644 index 00000000000..e01a854e3a2 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_2.yml @@ -0,0 +1,198 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:16 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + The Grapes of Wrath + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '124' + body: + encoding: UTF-8 + string: | + + The Grapes of Wrath + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:16 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '166' + body: + encoding: UTF-8 + string: | + + a6a887584d343dc77e5d94d4e18dfe68 + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:16 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:16 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '148' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:16 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_3.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_3.yml new file mode 100644 index 00000000000..bb440d9a885 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/maintained_project_successfully_removed/1_29_1_1_3.yml @@ -0,0 +1,198 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:33 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_meta?user=tom + body: + encoding: UTF-8 + string: | + + Far From the Madding Crowd + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '131' + body: + encoding: UTF-8 + string: | + + Far From the Madding Crowd + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:33 GMT +- request: + method: put + uri: http://backend:5352/source/project_1/_project/_attribute?meta=1&user=tom + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '166' + body: + encoding: UTF-8 + string: | + + 0801b214b3875f0cd926ace3df191f9a + + tom + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:34 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:34 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '148' + body: + encoding: UTF-8 + string: | + <project name="home:tom" kind="maintenance"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:15:34 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_1.yml new file mode 100644 index 00000000000..89d3b355569 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_1.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_2.yml new file mode 100644 index 00000000000..89d3b355569 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_remove_maintained_project/with_maintained_kind/with_an_invalid_maintained_project/1_29_1_2_2.yml @@ -0,0 +1,77 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +- request: + method: get + uri: http://backend:5352/build/home:tom/_result?code=unresolvable&view=status + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '56' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:16:11 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_1.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_1.yml new file mode 100644 index 00000000000..cf874e36c9f --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_1.yml @@ -0,0 +1,108 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:20 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_config?user=tom + body: + encoding: UTF-8 + string: save config + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '21' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: get + uri: http://backend:5352/source/home:tom/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '11' + body: + encoding: UTF-8 + string: save config + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_2.yml b/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_2.yml new file mode 100644 index 00000000000..feb35b8cf01 --- /dev/null +++ b/src/api/spec/cassettes/Webui_ProjectController/POST_save_prjconf/can_save_a_project_config/1_34_1_2.yml @@ -0,0 +1,108 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_config?user=tom + body: + encoding: UTF-8 + string: save config + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '21' + body: + encoding: UTF-8 + string: ' + +' + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +- request: + method: get + uri: http://backend:5352/source/home:tom/_config + body: + encoding: US-ASCII + string: '' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/plain + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '11' + body: + encoding: UTF-8 + string: save config + http_version: + recorded_at: Fri, 30 Nov 2018 16:19:21 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/GET_meta/1_1_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/GET_meta/1_1_1.yml new file mode 100644 index 00000000000..fdffba04cab --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/GET_meta/1_1_1.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_1.yml new file mode 100644 index 00000000000..b5de4183e25 --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_1.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:49 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_2.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_2.yml new file mode 100644 index 00000000000..b5de4183e25 --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_non_existing_repository_path/1_2_2_4_2.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:49 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_1.yml new file mode 100644 index 00000000000..38e5fd3ee5c --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_1.yml @@ -0,0 +1,83 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '85' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_2.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_2.yml new file mode 100644 index 00000000000..38e5fd3ee5c --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_a_valid_meta/1_2_2_3_2.yml @@ -0,0 +1,83 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '85' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_1.yml new file mode 100644 index 00000000000..fdffba04cab --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_1.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_2.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_2.yml new file mode 100644 index 00000000000..fdffba04cab --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/with_an_invalid_devel_project/1_2_2_2_2.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_1.yml new file mode 100644 index 00000000000..b5de4183e25 --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_1.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:49 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_2.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_2.yml new file mode 100644 index 00000000000..b5de4183e25 --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_a_valid_project/without_a_valid_meta/1_2_2_1_2.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:49 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_an_nonexistent_project/1_2_1_1.yml b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_an_nonexistent_project/1_2_1_1.yml new file mode 100644 index 00000000000..fdffba04cab --- /dev/null +++ b/src/api/spec/cassettes/Webui_Projects_MetaController/POST_update/with_an_nonexistent_project/1_2_1_1.yml @@ -0,0 +1,44 @@ +--- +http_interactions: +- request: + method: put + uri: http://backend:5352/source/home:tom/_meta?user=tom + body: + encoding: UTF-8 + string: | + + + <description/> + <person userid="tom" role="maintainer"/> + </project> + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - text/xml + Cache-Control: + - no-cache + Connection: + - close + Content-Length: + - '129' + body: + encoding: UTF-8 + string: | + <project name="home:tom"> + <title> + + + + http_version: + recorded_at: Fri, 30 Nov 2018 15:20:48 GMT +recorded_with: VCR 4.0.0 diff --git a/src/api/spec/controllers/webui/project_controller_spec.rb b/src/api/spec/controllers/webui/project_controller_spec.rb index 4625a626d0e..2863f51c9ad 100644 --- a/src/api/spec/controllers/webui/project_controller_spec.rb +++ b/src/api/spec/controllers/webui/project_controller_spec.rb @@ -756,69 +756,6 @@ end end - describe 'POST #save_meta' do - before do - login user - end - - context 'with an nonexistent project' do - let(:post_save_meta) { post :save_meta, params: { project: 'nonexistent_project' }, xhr: true } - - it { expect { post_save_meta }.to raise_error(Pundit::NotDefinedError) } - end - - context 'with a valid project' do - context 'without a valid meta' do - before do - post :save_meta, params: { project: user.home_project, meta: '</project>' }, xhr: true - end - - it { expect(flash.now[:error]).not_to be_nil } - it { expect(response).to have_http_status(:bad_request) } - end - - context 'with an invalid devel project' do - before do - post :save_meta, params: { project: user.home_project, - meta: '<project name="home:tom"><title/><description/><devel project="non-existant"/></project>' }, xhr: true - end - - it { expect(flash.now[:error]).to eq("Project with name 'non-existant' not found") } - it { expect(response).to have_http_status(:bad_request) } - end - - context 'with a valid meta' do - before do - post :save_meta, params: { project: user.home_project, meta: '<project name="home:tom"><title/><description/></project>' }, xhr: true - end - - it { expect(flash.now[:success]).not_to be_nil } - it { expect(response).to have_http_status(:ok) } - end - - context 'with a non existing repository path' do - let(:meta) do - <<-HEREDOC - <project name="home:tom"> - <title/> - <description/> - <repository name="not-existent"> - <path project="not-existent" repository="standard" /> - </repository> - </project> - HEREDOC - end - - before do - post :save_meta, params: { project: user.home_project, meta: meta }, xhr: true - end - - it { expect(flash.now[:error]).to eq('A project with the name not-existent does not exist. Please update the repository path elements.') } - it { expect(response).to have_http_status(:bad_request) } - end - end - end - describe 'POST #unlock' do before do login user @@ -1563,15 +1500,6 @@ it { expect(response).to have_http_status(:success) } end - describe 'GET #meta' do - before do - login user - get :meta, params: { project: user.home_project } - end - - it { expect(response).to have_http_status(:success) } - end - describe 'GET #edit' do context 'when the user has access to the project' do before do diff --git a/src/api/spec/controllers/webui/projects/meta_controller_spec.rb b/src/api/spec/controllers/webui/projects/meta_controller_spec.rb new file mode 100644 index 00000000000..b6b7bffb592 --- /dev/null +++ b/src/api/spec/controllers/webui/projects/meta_controller_spec.rb @@ -0,0 +1,76 @@ +require 'rails_helper' + +RSpec.describe Webui::Projects::MetaController, vcr: true do + let(:user) { create(:confirmed_user, login: 'tom') } + + describe 'GET #meta' do + before do + login user + get :show, params: { project: user.home_project } + end + + it { expect(response).to have_http_status(:success) } + end + + describe 'POST #update' do + before do + login user + end + + context 'with a nonexistent project' do + let(:post_save_meta) { post :update, params: { project: 'nonexistent_project' }, xhr: true } + + it { expect { post_save_meta }.to raise_error(Pundit::NotDefinedError) } + end + + context 'with a valid project' do + context 'without a valid meta' do + before do + post :update, params: { project: user.home_project, meta: '<project name="home:tom"><title/></project>' }, xhr: true + end + + it { expect(flash.now[:error]).not_to be_nil } + it { expect(response).to have_http_status(:bad_request) } + end + + context 'with an invalid devel project' do + before do + post :update, params: { project: user.home_project, + meta: '<project name="home:tom"><title/><description/><devel project="non-existant"/></project>' }, xhr: true + end + + it { expect(flash.now[:error]).to eq("Project with name 'non-existant' not found") } + it { expect(response).to have_http_status(:bad_request) } + end + + context 'with a valid meta' do + before do + post :update, params: { project: user.home_project, meta: '<project name="home:tom"><title/><description/></project>' }, xhr: true + end + + it { expect(flash.now[:success]).not_to be_nil } + it { expect(response).to have_http_status(:ok) } + end + + context 'with a non existing repository path' do + let(:meta) do + <<-HEREDOC + <project name="home:tom"> + <title/> + <description/> + <repository name="not-existent"> + <path project="not-existent" repository="standard" /> + </repository> + </project> + HEREDOC + end + before do + post :update, params: { project: user.home_project, meta: meta }, xhr: true + end + + it { expect(flash.now[:error]).to eq('A project with the name not-existent does not exist. Please update the repository path elements.') } + it { expect(response).to have_http_status(:bad_request) } + end + end + end +end From 5c94e8fcab18ce1974e9d12b34233c4abd54cbf4 Mon Sep 17 00:00:00 2001 From: Victor Pereira <vpereira@suse.de> Date: Tue, 4 Dec 2018 11:27:33 +0100 Subject: [PATCH 2/2] Create service classes and use only set_project before_action --- .../webui/projects/meta_controller.rb | 54 ++++++------------- .../meta_controller_service/meta_validator.rb | 25 +++++++++ .../meta_xml_validator.rb | 22 ++++++++ .../project_updater.rb | 30 +++++++++++ .../webui/projects/meta_controller_spec.rb | 2 +- 5 files changed, 93 insertions(+), 40 deletions(-) create mode 100644 src/api/app/services/meta_controller_service/meta_validator.rb create mode 100644 src/api/app/services/meta_controller_service/meta_xml_validator.rb create mode 100644 src/api/app/services/meta_controller_service/project_updater.rb diff --git a/src/api/app/controllers/webui/projects/meta_controller.rb b/src/api/app/controllers/webui/projects/meta_controller.rb index 69909e7150f..e7984895419 100644 --- a/src/api/app/controllers/webui/projects/meta_controller.rb +++ b/src/api/app/controllers/webui/projects/meta_controller.rb @@ -1,10 +1,8 @@ module Webui module Projects class MetaController < WebuiController - require_dependency 'opensuse/validator' - before_action :set_project, only: [:show] - before_action :set_project_by_name, only: [:update] - before_action :validate_meta, only: [:update], unless: -> { !params[:meta] } + before_action :set_project + before_action :validate_meta, only: [:update], if: -> { params[:meta] } after_action :verify_authorized, only: [:update] def show @@ -14,14 +12,14 @@ def show def update authorize @project, :update? - errors = [] - errors = validate_request_and_set_error(errors) - errors = run_update(errors) if errors.empty? - status = if errors.empty? + updater = ::MetaControllerService::ProjectUpdater.new(project: @project, request_data: @request_data) + updater.call + + status = if updater.valid? flash.now[:success] = 'Config successfully saved!' 200 else - flash.now[:error] = errors.compact.join("\n") + flash.now[:error] = updater.errors 400 end switch_to_webui2 @@ -31,41 +29,19 @@ def update private def validate_meta - Suse::Validator.validate('project', params[:meta]) - @request_data = Xmlhash.parse(params[:meta]) - rescue Suse::ValidationError => exception - flash.now[:error] = exception.message - render layout: false, status: 400, partial: "layouts/#{view_namespace}/flash", object: flash + meta_validator = ::MetaControllerService::MetaXMLValidator.new(params) + meta_validator.call + if meta_validator.errors? + flash.now[:error] = meta_validator.errors + render layout: false, status: 400, partial: "layouts/#{view_namespace}/flash", object: flash + else + @request_data = meta_validator.request_data + end end def view_namespace switch_to_webui2? ? 'webui2' : 'webui' end - - def validate_request_and_set_error(errors) - remove_repositories = @project.get_removed_repositories(@request_data) - errors << Project.check_repositories(remove_repositories)[:error] - errors << Project.validate_remote_permissions(@request_data)[:error] - errors << Project.validate_link_xml_attribute(@request_data, @project.name)[:error] - errors << Project.validate_maintenance_xml_attribute(@request_data)[:error] - errors << Project.validate_repository_xml_attribute(@request_data, @project.name)[:error] - errors.compact - end - - def run_update(errors) - Project.transaction do - errors << @project.update_from_xml(@request_data)[:error] - errors = errors.compact - @project.store if errors.empty? - end - errors.compact - end - - def set_project_by_name - @project = Project.get_by_name(params[:project]) - rescue Project::UnknownObjectError - @project = nil - end end end end diff --git a/src/api/app/services/meta_controller_service/meta_validator.rb b/src/api/app/services/meta_controller_service/meta_validator.rb new file mode 100644 index 00000000000..93e8027f1de --- /dev/null +++ b/src/api/app/services/meta_controller_service/meta_validator.rb @@ -0,0 +1,25 @@ +module MetaControllerService + class MetaValidator + attr_reader :project, :request_data, :errors + + def initialize(params = {}) + @project = params[:project] + @request_data = params[:request_data] + @errors = [] + end + + def call + remove_repositories = @project.get_removed_repositories(@request_data) + @errors << Project.check_repositories(remove_repositories)[:error] + @errors << Project.validate_remote_permissions(@request_data)[:error] + @errors << Project.validate_link_xml_attribute(@request_data, @project.name)[:error] + @errors << Project.validate_maintenance_xml_attribute(@request_data)[:error] + @errors << Project.validate_repository_xml_attribute(@request_data, @project.name)[:error] + @errors.compact! + end + + def valid? + @errors.empty? + end + end +end diff --git a/src/api/app/services/meta_controller_service/meta_xml_validator.rb b/src/api/app/services/meta_controller_service/meta_xml_validator.rb new file mode 100644 index 00000000000..a6bbd3c21a8 --- /dev/null +++ b/src/api/app/services/meta_controller_service/meta_xml_validator.rb @@ -0,0 +1,22 @@ +module MetaControllerService + class MetaXMLValidator + require_dependency 'opensuse/validator' + + attr_reader :meta, :request_data, :errors + + def initialize(params = {}) + @meta = params[:meta] + end + + def call + Suse::Validator.validate('project', @meta) + @request_data = Xmlhash.parse(@meta) + rescue Suse::ValidationError => exception + @errors = exception.message + end + + def errors? + @errors.present? + end + end +end diff --git a/src/api/app/services/meta_controller_service/project_updater.rb b/src/api/app/services/meta_controller_service/project_updater.rb new file mode 100644 index 00000000000..7c43fc82001 --- /dev/null +++ b/src/api/app/services/meta_controller_service/project_updater.rb @@ -0,0 +1,30 @@ +module MetaControllerService + class ProjectUpdater + def initialize(project: nil, request_data: {}, validator_klass: ::MetaControllerService::MetaValidator) + @project = project + @request_data = request_data + @validator = validator_klass.new(project: project, request_data: request_data) + end + + def call + @validator.call + unless @validator.valid? + @errors = @validator.errors + return + end + + Project.transaction do + @errors = @project.update_from_xml(@request_data)[:error] + @project.store if valid? + end + end + + def errors + @errors.is_a?(Array) ? @errors.join("\n") : @errors + end + + def valid? + @validator.valid? && @errors.blank? + end + end +end diff --git a/src/api/spec/controllers/webui/projects/meta_controller_spec.rb b/src/api/spec/controllers/webui/projects/meta_controller_spec.rb index b6b7bffb592..3b3c88acd43 100644 --- a/src/api/spec/controllers/webui/projects/meta_controller_spec.rb +++ b/src/api/spec/controllers/webui/projects/meta_controller_spec.rb @@ -20,7 +20,7 @@ context 'with a nonexistent project' do let(:post_save_meta) { post :update, params: { project: 'nonexistent_project' }, xhr: true } - it { expect { post_save_meta }.to raise_error(Pundit::NotDefinedError) } + it { expect { post_save_meta }.to raise_error(ActiveRecord::RecordNotFound) } end context 'with a valid project' do