Browse Source

Some files out of sync with upstream

master
Mike Barnes 2 months ago
parent
commit
7be42b0312
  1. 44
      spec/controllers/auth/sessions_controller_spec.rb
  2. 2
      spec/lib/activitypub/activity/create_spec.rb
  3. 14
      spec/services/notify_service_spec.rb
  4. 18
      spec/services/process_mentions_service_spec.rb

44
spec/controllers/auth/sessions_controller_spec.rb

@ -250,21 +250,6 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
end
context 'using a valid OTP, attempting to leverage previous half-login to bypass password auth' do
let!(:other_user) do
Fabricate(:user, email: 'z@y.com', password: 'abcdefgh', otp_required_for_login: false, current_sign_in_at: 1.month.ago)
end
before do
post :create, params: { user: { email: other_user.email, password: other_user.password } }
post :create, params: { user: { email: user.email, otp_attempt: user.current_otp } }, session: { attempt_user_updated_at: user.updated_at.to_s }
end
it "doesn't log the user in" do
expect(controller.current_user).to be_nil
end
end
context 'when the server has an decryption error' do
before do
allow_any_instance_of(User).to receive(:validate_and_consume_otp!).and_raise(OpenSSL::Cipher::CipherError)
@ -415,33 +400,4 @@ RSpec.describe Auth::SessionsController, type: :controller do
end
end
end
describe 'GET #webauthn_options' do
context 'with WebAuthn and OTP enabled as second factor' do
let(:domain) { "#{Rails.configuration.x.use_https ? 'https' : 'http' }://#{Rails.configuration.x.web_domain}" }
let(:fake_client) { WebAuthn::FakeClient.new(domain) }
let!(:user) do
Fabricate(:user, email: 'x@y.com', password: 'abcdefgh', otp_required_for_login: true, otp_secret: User.generate_otp_secret(32))
end
before do
user.update(webauthn_id: WebAuthn.generate_user_id)
public_key_credential = WebAuthn::Credential.from_create(fake_client.create)
user.webauthn_credentials.create(
nickname: 'SecurityKeyNickname',
external_id: public_key_credential.id,
public_key: public_key_credential.public_key,
sign_count: '1000'
)
post :create, params: { user: { email: user.email, password: user.password } }
end
it 'returns http success' do
get :webauthn_options
expect(response).to have_http_status :ok
end
end
end
end

2
spec/lib/activitypub/activity/create_spec.rb

@ -750,6 +750,7 @@ RSpec.describe ActivityPub::Activity::Create do
expect(poll.votes.first).to be_nil
end
end
end
context 'with an encrypted message' do
let(:recipient) { Fabricate(:account) }
@ -907,6 +908,7 @@ RSpec.describe ActivityPub::Activity::Create do
expect(status).to_not be_nil
expect(status.text).to eq 'Lorem ipsum'
end
end
context 'when the sender has no relevance to local activity' do
subject { described_class.new(json, sender, delivery: true) }

14
spec/services/notify_service_spec.rb

@ -83,20 +83,6 @@ RSpec.describe NotifyService, type: :service do
end
end
<<<<<<< HEAD
context 'if the message chain is initiated by recipient, but without a mention to the sender, even if the sender sends multiple messages in a row' do
let(:reply_to) { Fabricate(:status, account: recipient) }
let!(:mention) { Fabricate(:mention, account: sender, status: reply_to) }
let(:dummy_reply) { Fabricate(:status, account: sender, visibility: :direct, thread: reply_to) }
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: dummy_reply)) }
it 'does not notify' do
is_expected.to_not change(Notification, :count)
end
end
=======
>>>>>>> v3.5.2
context 'if the message chain is initiated by the recipient with a mention to the sender' do
let(:reply_to) { Fabricate(:status, account: recipient, visibility: :direct) }
let!(:mention) { Fabricate(:mention, account: sender, status: reply_to) }

18
spec/services/process_mentions_service_spec.rb

@ -45,24 +45,6 @@ RSpec.describe ProcessMentionsService, type: :service do
expect(remote_user.mentions.where(status: status).count).to eq 1
end
end
context 'with an IDN TLD' do
let(:remote_user) { Fabricate(:account, username: 'foo', protocol: :activitypub, domain: 'xn--y9a3aq.xn--y9a3aq', inbox_url: 'http://example.com/inbox') }
let(:status) { Fabricate(:status, account: account, text: "Hello @foo@հայ.հայ") }
before do
stub_request(:post, remote_user.inbox_url)
subject.call(status)
end
it 'creates a mention' do
expect(remote_user.mentions.where(status: status).count).to eq 1
end
it 'sends activity to the inbox' do
expect(a_request(:post, remote_user.inbox_url)).to have_been_made.once
end
end
end
context 'Temporarily-unreachable ActivityPub user' do

Loading…
Cancel
Save