Merge pull request 'Add custom LDAP attributes to schema' (#181) from feature/custom_ldap_attributes into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #181 Reviewed-by: greg <greg@noreply.kosmos.org>
This commit was merged in pull request #181.
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Experimental Settings', type: :feature do
|
||||
RSpec.describe 'Nostr Settings', type: :feature do
|
||||
let(:user) { create :user, cn: 'jimmy', ou: 'kosmos.org' }
|
||||
|
||||
before do
|
||||
login_as user, scope: :user
|
||||
|
||||
allow_any_instance_of(User).to receive(:dn)
|
||||
.and_return("cn=#{user.cn},ou=kosmos.org,cn=users,dc=kosmos,dc=org")
|
||||
allow_any_instance_of(User).to receive(:nostr_pubkey).and_return(nil)
|
||||
end
|
||||
|
||||
describe 'Adding a nostr pubkey' do
|
||||
scenario 'Without nostr browser extension available' do
|
||||
visit setting_path(:experiments)
|
||||
visit setting_path(:nostr)
|
||||
expect(page).to have_content("No browser extension found")
|
||||
expect(page).to have_css('button[data-settings--nostr-pubkey-target=setPubkey]:disabled')
|
||||
end
|
||||
@@ -22,19 +26,22 @@ RSpec.describe 'Experimental Settings', type: :feature do
|
||||
|
||||
context "With pubkey configured" do
|
||||
before do
|
||||
user.update! nostr_pubkey: "07e188a1ff87ce171d517b8ed2bb7a31b1d3453a0db3b15379ec07b724d232f3"
|
||||
allow_any_instance_of(User).to receive(:nostr_pubkey)
|
||||
.and_return("ce273cbfb0d4e3e06930773a337c1459e4849efd4cb4c751b906a561c98a6d09")
|
||||
end
|
||||
|
||||
scenario 'Remove nostr pubkey from account' do
|
||||
visit setting_path(:experiments)
|
||||
visit setting_path(:nostr)
|
||||
expect(page).to have_field("nostr_public_key",
|
||||
with: "npub1qlsc3g0lsl8pw8230w8d9wm6xxcax3f6pkemz5measrmwfxjxteslf2hac",
|
||||
with: "npub1ecnne0as6n37q6fswuarxlq5t8jgf8hafj6vw5deq6jkrjv2d5ysnehu73",
|
||||
disabled: true)
|
||||
|
||||
expect(LdapManager::UpdateNostrKey).to receive(:call).with(
|
||||
dn: "cn=jimmy,ou=kosmos.org,cn=users,dc=kosmos,dc=org",
|
||||
pubkey: nil
|
||||
)
|
||||
|
||||
click_link "Remove"
|
||||
expect(page).to_not have_field("nostr_public_key")
|
||||
expect(page).to have_content("verify your public key")
|
||||
expect(user.reload.nostr_pubkey).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user