mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 15:09:29 +00:00
Add assertion about key columns to account key generate spec (#30635)
This commit is contained in:
parent
1dd8262071
commit
91ef4a6fc5
|
@ -1015,21 +1015,26 @@ RSpec.describe Account do
|
||||||
|
|
||||||
context 'when is local' do
|
context 'when is local' do
|
||||||
it 'generates keys' do
|
it 'generates keys' do
|
||||||
account = described_class.create!(domain: nil, username: Faker::Internet.user_name(separators: ['_']))
|
account = described_class.create!(domain: nil, username: 'user_without_keys')
|
||||||
expect(account.keypair).to be_private
|
|
||||||
expect(account.keypair).to be_public
|
expect(account)
|
||||||
|
.to be_private_key
|
||||||
|
.and be_public_key
|
||||||
|
expect(account.keypair)
|
||||||
|
.to be_private
|
||||||
|
.and be_public
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is remote' do
|
context 'when is remote' do
|
||||||
it 'does not generate keys' do
|
it 'does not generate keys' do
|
||||||
key = OpenSSL::PKey::RSA.new(1024).public_key
|
key = OpenSSL::PKey::RSA.new(1024).public_key
|
||||||
account = described_class.create!(domain: 'remote', uri: 'https://remote/actor', username: Faker::Internet.user_name(separators: ['_']), public_key: key.to_pem)
|
account = described_class.create!(domain: 'remote', uri: 'https://remote/actor', username: 'remote_user_with_public', public_key: key.to_pem)
|
||||||
expect(account.keypair.params).to eq key.params
|
expect(account.keypair.params).to eq key.params
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'normalizes domain' do
|
it 'normalizes domain' do
|
||||||
account = described_class.create!(domain: 'にゃん', uri: 'https://xn--r9j5b5b/actor', username: Faker::Internet.user_name(separators: ['_']))
|
account = described_class.create!(domain: 'にゃん', uri: 'https://xn--r9j5b5b/actor', username: 'remote_user_with_idn_domain')
|
||||||
expect(account.domain).to eq 'xn--r9j5b5b'
|
expect(account.domain).to eq 'xn--r9j5b5b'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue