FEATURE: add profile_background fields into SSO (#5701)

Add profile_background and card_background fields into Discourse SSO.
This commit is contained in:
Misaka 0x4e21
2018-05-07 08:03:26 +00:00
committed by Régis Hanol
parent 5a57a454fe
commit ff6be3c2e3
15 changed files with 474 additions and 4 deletions

View File

@ -202,4 +202,39 @@ describe UserProfile do
end
end
end
context '.import_url_for_user' do
let(:user) { Fabricate(:user) }
before do
stub_request(:any, "thisfakesomething.something.com")
.to_return(body: "abc", status: 404, headers: { 'Content-Length' => 3 })
end
describe 'when profile_background_url returns an invalid status code' do
it 'should not do anything' do
url = "http://thisfakesomething.something.com/"
UserProfile.import_url_for_user(url, user, is_card_background: false)
user.reload
expect(user.user_profile.profile_background).to eq(nil)
end
end
describe 'when card_background_url returns an invalid status code' do
it 'should not do anything' do
url = "http://thisfakesomething.something.com/"
UserProfile.import_url_for_user(url, user, is_card_background: true)
user.reload
expect(user.user_profile.card_background).to eq(nil)
end
end
end
end