fix the build

This commit is contained in:
Arpit Jalan 2017-12-23 14:16:48 +05:30
parent 0514ac4ee2
commit ef4c6c67ba
9 changed files with 16 additions and 2 deletions

View File

@ -469,6 +469,7 @@ describe Guardian do
end
it 'returns false for all users when sso is enabled' do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
expect(Guardian.new(trust_level_2).can_invite_via_email?(topic)).to be_falsey
@ -2176,6 +2177,7 @@ describe Guardian do
context 'when SSO username override is active' do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.sso_overrides_username = true
end
@ -2250,6 +2252,7 @@ describe Guardian do
context 'when SSO email override is active' do
before do
SiteSetting.email_editable = false
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.sso_overrides_email = true
end
@ -2337,6 +2340,7 @@ describe Guardian do
context 'when SSO is enabled' do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
end

View File

@ -6,6 +6,7 @@ RSpec.describe SsoOverridesEmailValidator do
describe '#valid_value?' do
describe "when 'email editable' is true" do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.email_editable = true
end
@ -29,6 +30,7 @@ RSpec.describe SsoOverridesEmailValidator do
describe "when 'email editable' is false" do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.email_editable = false
end

View File

@ -738,6 +738,7 @@ describe Admin::UsersController do
log_in(:admin)
SiteSetting.email_editable = false
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.sso_overrides_email = true
SiteSetting.sso_overrides_name = true

View File

@ -315,6 +315,7 @@ describe InvitesController do
end
it "does not send password reset email if sso is enabled" do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
put :perform_accept_invitation, params: { id: invite.invite_key }, format: :json

View File

@ -34,8 +34,8 @@ describe SessionController do
request.host = Discourse.current_hostname
SiteSetting.enable_sso = true
SiteSetting.sso_url = @sso_url
SiteSetting.enable_sso = true
SiteSetting.sso_secret = @sso_secret
# We have 2 options, either fabricate an admin or don't
@ -487,6 +487,7 @@ describe SessionController do
context 'SSO is enabled' do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
post :create, params: {
@ -827,6 +828,7 @@ describe SessionController do
context 'SSO is enabled' do
before do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
post :create, params: {

View File

@ -495,6 +495,7 @@ describe UsersController do
context 'logs in admin' do
it 'does not log in admin with invalid token' do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
get :admin_login, params: { token: "invalid" }
expect(session[:current_user_id]).to be_blank
@ -511,6 +512,7 @@ describe UsersController do
end
it 'logs in admin with SSO enabled' do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
token = admin.email_tokens.create(email: admin.email).token

View File

@ -26,6 +26,7 @@ describe Jobs::ExportCsvFile do
end
it 'exports sso data' do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
user = Fabricate(:user)
user.user_profile.update_column(:location, "La La Land")

View File

@ -5,8 +5,8 @@ describe DiscourseSingleSignOn do
@sso_url = "http://somesite.com/discourse_sso"
@sso_secret = "shjkfdhsfkjh"
SiteSetting.enable_sso = true
SiteSetting.sso_url = @sso_url
SiteSetting.enable_sso = true
SiteSetting.sso_secret = @sso_secret
end

View File

@ -112,6 +112,7 @@ describe UserUpdater do
context 'when sso overrides bio' do
it 'does not change bio' do
SiteSetting.sso_url = "https://www.example.com/sso"
SiteSetting.enable_sso = true
SiteSetting.sso_overrides_bio = true