Merge pull request 'Add lndhub admin panel, quick stats for admin pages' (#80) from feature/admin_stats into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #80
Reviewed-by: bumi <bumi@noreply.kosmos.org>
This commit was merged in pull request #80.
This commit is contained in:
2023-02-23 07:43:15 +00:00
45 changed files with 604 additions and 129 deletions

View File

@@ -4,7 +4,9 @@ RSpec.describe 'Admin dashboard', type: :feature do
let(:user) { create :user }
before do
allow(user).to receive(:is_admin?).and_return(true)
allow(Devise::LDAP::Adapter).to receive(:get_ldap_param)
.with(user.cn, :admin).and_return(["true"])
login_as user, :scope => :user
end

View File

@@ -0,0 +1,21 @@
require 'rails_helper'
RSpec.describe 'Admin/global settings', type: :feature do
let(:user) { create :user }
before do
allow(Devise::LDAP::Adapter).to receive(:get_ldap_param)
.with(user.cn, :admin).and_return(["true"])
login_as user, :scope => :user
end
scenario 'Update reserved usernames' do
visit admin_settings_registrations_path
expect(Setting.reserved_usernames).not_to include(['Kosmos', 'Kredits'])
fill_in 'Reserved usernames', with: "Kosmos\nKredits"
click_button "Save"
expect(Setting.reserved_usernames).to eq(['Kosmos', 'Kredits'])
end
end

View File

@@ -71,6 +71,12 @@ RSpec.describe "Signup", type: :feature do
fill_in "user_cn", with: "t"
click_button "Continue"
expect(page).to have_content("Username is too short")
fill_in "user_cn", with: "-tony"
click_button "Continue"
expect(page).to have_content("Username is invalid")
fill_in "user_cn", with: "$atoshi"
click_button "Continue"
expect(page).to have_content("Username is invalid")
fill_in "user_cn", with: "jimmy"
click_button "Continue"
expect(page).to have_content("Username has already been taken")
@@ -103,5 +109,11 @@ RSpec.describe "Signup", type: :feature do
expect(page).to have_content("confirm your address")
end
end
scenario "Reserved usernames" do
fill_in "user_cn", with: "accounts"
click_button "Continue"
expect(page).to have_content("Username has already been taken")
end
end
end