2
0

Fix tootctl admin create not bypassing reserved username checks (#35779)

This commit is contained in:
Claire
2025-08-14 15:35:19 +02:00
parent 7a862d3308
commit ea5d1f0297
3 changed files with 13 additions and 8 deletions

View File

@@ -32,6 +32,7 @@ RSpec.describe Mastodon::CLI::Accounts do
describe '#create' do
let(:action) { :create }
let(:username) { 'tootctl_username' }
shared_examples 'a new user with given email address and username' do
it 'creates user and accounts from options and displays success message' do
@@ -48,18 +49,24 @@ RSpec.describe Mastodon::CLI::Accounts do
end
def account_from_options
Account.find_local('tootctl_username')
Account.find_local(username)
end
end
context 'when required USERNAME and --email are provided' do
let(:arguments) { ['tootctl_username'] }
let(:arguments) { [username] }
context 'with USERNAME and --email only' do
let(:options) { { email: 'tootctl@example.com' } }
it_behaves_like 'a new user with given email address and username'
context 'with a reserved username' do
let(:username) { 'security' }
it_behaves_like 'a new user with given email address and username'
end
context 'with invalid --email value' do
let(:options) { { email: 'invalid' } }