|
|
@ -4,8 +4,9 @@ describe Api::V1::Accounts::CredentialsController do
|
|
|
|
render_views
|
|
|
|
render_views
|
|
|
|
|
|
|
|
|
|
|
|
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
|
|
|
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
|
|
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'write') }
|
|
|
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read write') }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'with an oauth token' do
|
|
|
|
before do
|
|
|
|
before do
|
|
|
|
allow(controller).to receive(:doorkeeper_token) { token }
|
|
|
|
allow(controller).to receive(:doorkeeper_token) { token }
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -59,3 +60,24 @@ describe Api::V1::Accounts::CredentialsController do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'without an oauth token' do
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
|
|
|
allow(controller).to receive(:doorkeeper_token) { nil }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe 'GET #show' do
|
|
|
|
|
|
|
|
it 'returns http unauthorized' do
|
|
|
|
|
|
|
|
get :show
|
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe 'PATCH #update' do
|
|
|
|
|
|
|
|
it 'returns http unauthorized' do
|
|
|
|
|
|
|
|
patch :update, params: { note: 'Foo' }
|
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|