Skip to content

Commit

Permalink
Move OAuth flow tests from feature tests to system tests (mastodon#29837
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ClearlyClaire authored Apr 5, 2024
1 parent b61ae28 commit e73cf35
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions spec/features/oauth_spec.rb → spec/system/oauth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
require 'rails_helper'

describe 'Using OAuth from an external app' do
let(:client_app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/', scopes: 'read') }
let(:client_app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/health', scopes: 'read') }

context 'when the user is already logged in' do
let!(:user) { Fabricate(:user) }

before do
sign_in user, scope: :user
visit new_user_session_path
fill_in_auth_details(user.email, user.password)
end

it 'when accepting the authorization request' do
Expand Down Expand Up @@ -164,20 +165,19 @@
expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be false
end
end
# TODO: external auth
end

private

def fill_in_auth_details(email, password)
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_on I18n.t('auth.login')
end
private

def fill_in_otp_details(value)
fill_in 'user_otp_attempt', with: value
click_on I18n.t('auth.login')
end
def fill_in_auth_details(email, password)
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_on I18n.t('auth.login')
end

# TODO: external auth
def fill_in_otp_details(value)
fill_in 'user_otp_attempt', with: value
click_on I18n.t('auth.login')
end
end

0 comments on commit e73cf35

Please sign in to comment.