Commit b15b213e authored by Markus Koller's avatar Markus Koller

Add specs for changing wiki_page_max_content_bytes through the API

Also declare the param explicitly in `lib/api/settings.rb`, although
it was already included via the `optional_attributes` helper.
parent 10eb485f
...@@ -150,6 +150,7 @@ module API ...@@ -150,6 +150,7 @@ module API
end end
optional :issues_create_limit, type: Integer, desc: "Maximum number of issue creation requests allowed per minute per user. Set to 0 for unlimited requests per minute." optional :issues_create_limit, type: Integer, desc: "Maximum number of issue creation requests allowed per minute per user. Set to 0 for unlimited requests per minute."
optional :raw_blob_request_limit, type: Integer, desc: "Maximum number of requests per minute for each raw path. Set to 0 for unlimited requests per minute." optional :raw_blob_request_limit, type: Integer, desc: "Maximum number of requests per minute for each raw path. Set to 0 for unlimited requests per minute."
optional :wiki_page_max_content_bytes, type: Integer, desc: "Maximum wiki page content size in bytes"
ApplicationSetting::SUPPORTED_KEY_TYPES.each do |type| ApplicationSetting::SUPPORTED_KEY_TYPES.each do |type|
optional :"#{type}_key_restriction", optional :"#{type}_key_restriction",
......
...@@ -39,6 +39,7 @@ RSpec.describe API::Settings, 'Settings' do ...@@ -39,6 +39,7 @@ RSpec.describe API::Settings, 'Settings' do
expect(json_response['snippet_size_limit']).to eq(50.megabytes) expect(json_response['snippet_size_limit']).to eq(50.megabytes)
expect(json_response['spam_check_endpoint_enabled']).to be_falsey expect(json_response['spam_check_endpoint_enabled']).to be_falsey
expect(json_response['spam_check_endpoint_url']).to be_nil expect(json_response['spam_check_endpoint_url']).to be_nil
expect(json_response['wiki_page_max_content_bytes']).to be_a(Integer)
end end
end end
...@@ -116,7 +117,8 @@ RSpec.describe API::Settings, 'Settings' do ...@@ -116,7 +117,8 @@ RSpec.describe API::Settings, 'Settings' do
spam_check_endpoint_enabled: true, spam_check_endpoint_enabled: true,
spam_check_endpoint_url: 'https://example.com/spam_check', spam_check_endpoint_url: 'https://example.com/spam_check',
disabled_oauth_sign_in_sources: 'unknown', disabled_oauth_sign_in_sources: 'unknown',
import_sources: 'github,bitbucket' import_sources: 'github,bitbucket',
wiki_page_max_content_bytes: 12345
} }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -158,6 +160,7 @@ RSpec.describe API::Settings, 'Settings' do ...@@ -158,6 +160,7 @@ RSpec.describe API::Settings, 'Settings' do
expect(json_response['spam_check_endpoint_url']).to eq('https://example.com/spam_check') expect(json_response['spam_check_endpoint_url']).to eq('https://example.com/spam_check')
expect(json_response['disabled_oauth_sign_in_sources']).to eq([]) expect(json_response['disabled_oauth_sign_in_sources']).to eq([])
expect(json_response['import_sources']).to match_array(%w(github bitbucket)) expect(json_response['import_sources']).to match_array(%w(github bitbucket))
expect(json_response['wiki_page_max_content_bytes']).to eq(12345)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment