WIP certs
This commit is contained in:
parent
808754f8bd
commit
b575983c22
4 changed files with 15 additions and 14 deletions
|
|
@ -7,6 +7,10 @@ class AppConfig < Settingslogic
|
|||
|
||||
source File.join(Rails.root, "config", "application.yml")
|
||||
namespace Rails.env
|
||||
|
||||
if self[:ca_file].blank? && Rails.env.development?
|
||||
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
def self.load!
|
||||
if no_config_file? && !have_old_config_file?
|
||||
|
|
@ -36,10 +40,7 @@ HELP
|
|||
end
|
||||
|
||||
super
|
||||
|
||||
if self[:ca_file].blank? && Rails.env.development?
|
||||
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
||||
end
|
||||
|
||||
|
||||
if no_cert_file_in_prod?
|
||||
$stderr.puts <<-HELP
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Webfinger
|
|||
private
|
||||
def get_xrd
|
||||
begin
|
||||
http = RestClient.get xrd_url, OPTS
|
||||
http = Faraday.get xrd_url, OPTS
|
||||
|
||||
profile_url = webfinger_profile_url(http.body)
|
||||
if profile_url
|
||||
|
|
@ -69,7 +69,7 @@ class Webfinger
|
|||
|
||||
def get_webfinger_profile(profile_url)
|
||||
begin
|
||||
http = RestClient.get(profile_url, OPTS)
|
||||
http = Faraday.get(profile_url, OPTS)
|
||||
|
||||
rescue
|
||||
raise I18n.t('webfinger.fetch_failed', :profile_url => profile_url)
|
||||
|
|
@ -83,7 +83,7 @@ class Webfinger
|
|||
@wf_profile = WebfingerProfile.new(@account, webfinger_profile)
|
||||
|
||||
begin
|
||||
hcard = RestClient.get(@wf_profile.hcard, OPTS)
|
||||
hcard = Faraday.get(@wf_profile.hcard, OPTS)
|
||||
rescue
|
||||
return I18n.t('webfinger.hcard_fetch_failed', :account => @account)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ describe Webfinger do
|
|||
diaspora_xrd.stub!(:body).and_return(diaspora_xrd)
|
||||
hcard_xml.stub!(:body).and_return(hcard_xml)
|
||||
diaspora_finger.stub!(:body).and_return(diaspora_finger)
|
||||
RestClient.stub!(:get).and_return(diaspora_xrd, diaspora_finger, hcard_xml)
|
||||
Faraday.stub!(:get).and_return(diaspora_xrd, diaspora_finger, hcard_xml)
|
||||
#new_person = Factory.build(:person, :diaspora_handle => "tom@tom.joindiaspora.com")
|
||||
# http://tom.joindiaspora.com/.well-known/host-meta
|
||||
f = Webfinger.new("alice@example.org").fetch
|
||||
|
|
@ -90,7 +90,7 @@ describe Webfinger do
|
|||
f = Webfinger.new("tom@tom.joindiaspora.com")
|
||||
|
||||
diaspora_xrd.stub!(:body).and_return(diaspora_xrd)
|
||||
RestClient.should_receive(:get).twice.and_return(nil, diaspora_xrd)
|
||||
Faraday.should_receive(:get).twice.and_return(nil, diaspora_xrd)
|
||||
f.should_receive(:xrd_url).twice
|
||||
f.send(:get_xrd)
|
||||
f.instance_variable_get(:@ssl).should == false
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ describe Services::Facebook do
|
|||
|
||||
describe '#post' do
|
||||
it 'posts a status message to facebook' do
|
||||
RestClient.should_receive(:post).with("https://graph.facebook.com/me/feed", :message => @post.text, :access_token => @service.access_token)
|
||||
Faraday.should_receive(:post).with("https://graph.facebook.com/me/feed", :message => @post.text, :access_token => @service.access_token)
|
||||
@service.post(@post)
|
||||
end
|
||||
it 'swallows exception raised by facebook always being down' do
|
||||
RestClient.should_receive(:post).and_raise
|
||||
Faraday.should_receive(:post).and_raise
|
||||
@service.post(@post)
|
||||
end
|
||||
|
||||
it 'should call public message' do
|
||||
RestClient.stub!(:post)
|
||||
Faraday.stub!(:post)
|
||||
url = "foo"
|
||||
@service.should_receive(:public_message).with(@post, url)
|
||||
@service.post(@post, url)
|
||||
|
|
@ -53,12 +53,12 @@ describe Services::Facebook do
|
|||
JSON
|
||||
@web_mock = mock()
|
||||
@web_mock.stub!(:body).and_return(@fb_list_hash)
|
||||
RestClient.stub!(:get).and_return(@web_mock)
|
||||
Faraday.stub!(:get).and_return(@web_mock)
|
||||
end
|
||||
|
||||
describe '#save_friends' do
|
||||
it 'requests a friend list' do
|
||||
RestClient.should_receive(:get).with("https://graph.facebook.com/me/friends?fields[]=name&fields[]=picture&access_token=yeah").and_return(@web_mock)
|
||||
Faraday.should_receive(:get).with("https://graph.facebook.com/me/friends?fields[]=name&fields[]=picture&access_token=yeah").and_return(@web_mock)
|
||||
@service.save_friends
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue