Merge commit from fork
* Ensure tootctl revokes sessions, access tokens and web push subscriptions * Fix test coverage
This commit is contained in:
@@ -361,11 +361,20 @@ RSpec.describe Mastodon::CLI::Accounts do
|
||||
context 'with --reset-password option' do
|
||||
let(:options) { { reset_password: true } }
|
||||
|
||||
let(:user) { Fabricate(:user, password: original_password) }
|
||||
let(:original_password) { 'foobar12345' }
|
||||
let(:new_password) { 'new_password12345' }
|
||||
|
||||
it 'returns a new password for the user' do
|
||||
allow(SecureRandom).to receive(:hex).and_return('new_password')
|
||||
allow(SecureRandom).to receive(:hex).and_return(new_password)
|
||||
allow(Account).to receive(:find_local).and_return(user.account)
|
||||
allow(user).to receive(:change_password!).and_call_original
|
||||
|
||||
expect { subject }
|
||||
.to output_results('new_password')
|
||||
.to output_results(new_password)
|
||||
|
||||
expect(user).to have_received(:change_password!).with(new_password)
|
||||
expect(user.reload).to_not be_external_or_valid_password(original_password)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user