Skip to content

Commit

Permalink
fix: fix auth mode
Browse files Browse the repository at this point in the history
  • Loading branch information
syl-p committed Feb 23, 2024
1 parent 120c0f5 commit 654c196
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions test/controllers/oauth_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ class OauthControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

setup do
if ENV['ENABLE_AUTHENTICATION'].present?

end
@pia = FactoryBot.create(:pia)
@admin = FactoryBot.create(:user_admin, identifier: "admin")
@doorkeeper_token = doorkeeper_token
@auth = FactoryBot.create(:access_token)
Expand Down
14 changes: 7 additions & 7 deletions test/controllers/pias_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ class PiasControllerTest < ActionDispatch::IntegrationTest

test 'should update pia' do
pia_params = {}
if ENV['ENABLE_AUTHENTICATION'].present?
# assign users
pia_params[:authors] = [@user_functional.id, @user_user.id].join(",")
pia_params[:validators] = [@user_user.id].join(",")
end
# assign users
pia_params[:authors] = [@user_functional.id, @user_user.id].join(",")
pia_params[:validators] = [@user_user.id].join(",")

patch pia_url(@pia), params: { pia: pia_params }, headers: { 'Authorization' => "Bearer #{@doorkeeper_token}" }, as: :json
pia_response = JSON.parse(response.body)

assert_response 200
assert_equal pia_response["user_pias"].count, 3

if ENV['ENABLE_AUTHENTICATION'].present?
assert_equal pia_response["user_pias"].count, 3
end
end

test 'should destroy pia' do
Expand Down
2 changes: 1 addition & 1 deletion test/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

firstname { 'user' }
lastname { 'nothing' }
password { [*'0'..'9', *'a'..'z', *'A'..'Z', *'!'..'?'].sample(16).join('-') }
password { [*'0'..'9', *'a'..'z', *'A'..'Z', *'!'..'?'].sample(20).join('-') }
password_confirmation { password }
is_user { true }
email { "user+#{identifier ? identifier : 'default'}@test.com" }
Expand Down

0 comments on commit 654c196

Please sign in to comment.