allow create brand config without brand_config
fixes CORE-856 test plan - upload a file to a brand config - it should work Change-Id: I3b03ffe1aceded1fcfa9fcaf83b606293b2a4789 Reviewed-on: https://gerrit.instructure.com/138948 Reviewed-by: James Williams <jamesw@instructure.com> Tested-by: Jenkins Product-Review: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
a8a6b33bc1
commit
042504aef8
|
@ -104,6 +104,7 @@ class BrandConfigsController < ApplicationController
|
|||
# indicating the progress of generating the css and pushing it to the CDN
|
||||
# @returns {BrandConfig, Progress}
|
||||
def create
|
||||
params[:brand_config] ||= {}
|
||||
opts = {
|
||||
parent_md5: @account.first_parent_brand_config.try(:md5),
|
||||
variables: process_variables(params[:brand_config][:variables])
|
||||
|
@ -188,6 +189,7 @@ class BrandConfigsController < ApplicationController
|
|||
end
|
||||
|
||||
def process_variables(variables)
|
||||
return unless variables
|
||||
variables.to_unsafe_h.each_with_object({}) do |(key, value), memo|
|
||||
next unless value.present? && (config = BrandableCSS.variables_map[key])
|
||||
value = process_file(value) if config['type'] == 'image'
|
||||
|
|
|
@ -108,6 +108,12 @@ describe BrandConfigsController do
|
|||
expect(json['brand_config']['variables']['ic-brand-primary']).to eq "#000000"
|
||||
end
|
||||
|
||||
it "should not fail when a brand_config is not passed" do
|
||||
user_session(admin)
|
||||
post 'create', params: {account_id: @account.id}
|
||||
assert_status(200)
|
||||
end
|
||||
|
||||
it 'should not allow non admin access' do
|
||||
user = user_with_pseudonym(active_all: true)
|
||||
user_session(user)
|
||||
|
|
Loading…
Reference in New Issue