Drop support for basic authentication

This commit is contained in:
Tom Hughes 2024-09-01 15:26:35 +01:00
parent b4146947ad
commit 973d62a25e
22 changed files with 231 additions and 336 deletions

View file

@ -37,10 +37,9 @@ class CompressedRequestsTest < ActionDispatch::IntegrationTest
# upload it
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => diff,
:headers => {
"HTTP_AUTHORIZATION" => format("Basic %<auth>s", :auth => Base64.encode64("#{user.display_name}:test")),
:headers => bearer_authorization_header(user).merge(
"HTTP_CONTENT_TYPE" => "application/xml"
}
)
assert_response :success,
"can't upload an uncompressed diff to changeset: #{@response.body}"
@ -86,11 +85,10 @@ class CompressedRequestsTest < ActionDispatch::IntegrationTest
# upload it
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => gzip_content(diff),
:headers => {
"HTTP_AUTHORIZATION" => format("Basic %<auth>s", :auth => Base64.encode64("#{user.display_name}:test")),
:headers => bearer_authorization_header(user).merge(
"HTTP_CONTENT_ENCODING" => "gzip",
"HTTP_CONTENT_TYPE" => "application/xml"
}
)
assert_response :success,
"can't upload a gzip compressed diff to changeset: #{@response.body}"
@ -136,11 +134,10 @@ class CompressedRequestsTest < ActionDispatch::IntegrationTest
# upload it
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => deflate_content(diff),
:headers => {
"HTTP_AUTHORIZATION" => format("Basic %<auth>s", :auth => Base64.encode64("#{user.display_name}:test")),
:headers => bearer_authorization_header(user).merge(
"HTTP_CONTENT_ENCODING" => "deflate",
"HTTP_CONTENT_TYPE" => "application/xml"
}
)
assert_response :success,
"can't upload a deflate compressed diff to changeset: #{@response.body}"
@ -157,11 +154,10 @@ class CompressedRequestsTest < ActionDispatch::IntegrationTest
# upload it
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => "",
:headers => {
"HTTP_AUTHORIZATION" => format("Basic %<auth>s", :auth => Base64.encode64("#{user.display_name}:test")),
:headers => bearer_authorization_header(user).merge(
"HTTP_CONTENT_ENCODING" => "unknown",
"HTTP_CONTENT_TYPE" => "application/xml"
}
)
assert_response :unsupported_media_type
end