Skip to content
Extraits de code Groupes Projets
Valider eddcb71f rédigé par maxwell's avatar maxwell
Parcourir les fichiers

EM websocket cleanly merged with master. webfingering is now async

parent 58f836ab
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -67,5 +67,4 @@ class RequestsController < ApplicationController ...@@ -67,5 +67,4 @@ class RequestsController < ApplicationController
return return
end end
end end
end end
...@@ -134,7 +134,6 @@ namespace :db do ...@@ -134,7 +134,6 @@ namespace :db do
task :tom_seed, :roles => :tom do task :tom_seed, :roles => :tom do
run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}" run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}"
run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends" run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends"
sleep(20)
backers.each do |backer| backers.each do |backer|
run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept" run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept"
#run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo" #run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo"
......
...@@ -14,6 +14,9 @@ class EMWebfinger ...@@ -14,6 +14,9 @@ class EMWebfinger
def fetch def fetch
raise 'you need to set a callback before calling fetch' if @callbacks.empty? raise 'you need to set a callback before calling fetch' if @callbacks.empty?
query = /\A^#{Regexp.escape(@account.gsub('acct:', '').to_s)}\z/i
local_person = Person.first(:diaspora_handle => query)
person = Person.by_account_identifier(@account) person = Person.by_account_identifier(@account)
if person if person
process_callbacks person process_callbacks person
......
...@@ -53,8 +53,11 @@ describe RequestsController do ...@@ -53,8 +53,11 @@ describe RequestsController do
it 'should redirect to the page which you called it from ' do it 'should redirect to the page which you called it from ' do
pending "i need to figure out how to do this" pending "i need to figure out how to do this"
end end
<<<<<<< HEAD
it 'should not blow up if there is a problem mid way thru the webfinger process' do it 'should not blow up if there is a problem mid way thru the webfinger process' do
pending "i need to do this tomorrow pending "i need to do this tomorrow
end end
=======
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end end
...@@ -28,6 +28,10 @@ describe EMWebfinger do ...@@ -28,6 +28,10 @@ describe EMWebfinger do
let(:non_diaspora_hcard) {File.open(File.join(Rails.root, 'spec/fixtures/evan_hcard')).read} let(:non_diaspora_hcard) {File.open(File.join(Rails.root, 'spec/fixtures/evan_hcard')).read}
context 'setup' do context 'setup' do
<<<<<<< HEAD
=======
let(:action){ Proc.new{|person| puts person.inspect }}
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
describe '#intialize' do describe '#intialize' do
it 'sets account ' do it 'sets account ' do
...@@ -36,6 +40,7 @@ describe EMWebfinger do ...@@ -36,6 +40,7 @@ describe EMWebfinger do
end end
it 'should raise an error on an unresonable email' do it 'should raise an error on an unresonable email' do
<<<<<<< HEAD
proc{ proc{
EMWebfinger.new("joe.valid+email@my-address.com") EMWebfinger.new("joe.valid+email@my-address.com")
}.should_not raise_error(RuntimeError, "Identifier is invalid") }.should_not raise_error(RuntimeError, "Identifier is invalid")
...@@ -47,6 +52,10 @@ describe EMWebfinger do ...@@ -47,6 +52,10 @@ describe EMWebfinger do
EMWebfinger.new('eviljoe@diaspora.local:3000') EMWebfinger.new('eviljoe@diaspora.local:3000')
}.should raise_error(RuntimeError, "Identifier is invalid") }.should raise_error(RuntimeError, "Identifier is invalid")
end end
=======
proc{EMWebfinger.new("asfadfasdf")}.should raise_error
end
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end end
describe '#on_person' do describe '#on_person' do
...@@ -112,6 +121,10 @@ describe EMWebfinger do ...@@ -112,6 +121,10 @@ describe EMWebfinger do
} }
} }
end end
<<<<<<< HEAD
=======
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end end
end end
end end
......
...@@ -213,10 +213,40 @@ describe Person do ...@@ -213,10 +213,40 @@ describe Person do
f = Person.by_account_identifier("tom@tom.joindiaspora.com") f = Person.by_account_identifier("tom@tom.joindiaspora.com")
f.should be nil f.should be nil
end end
end end
describe '.local_by_account_identifier' do
it 'should find local users people' do
p = Person.local_by_account_identifier(user.diaspora_handle)
p.should == user.person
end
it 'identifier should be a valid email' do
pending "should check in the webfinger client"
stub_success("joe.valid+email@my-address.com")
Proc.new {
Person.by_account_identifier("joe.valid+email@my-address.com")
}.should_not raise_error(RuntimeError, "Identifier is invalid")
stub_success("not_a_@valid_email")
Proc.new {
Person.by_account_identifer("not_a_@valid_email")
}.should raise_error(RuntimeError, "Identifier is invalid")
end
it 'should not accept a port number' do
pending "should check the webfinger client"
stub_success("eviljoe@diaspora.local:3000")
Proc.new {
Person.by_account_identifier('eviljoe@diaspora.local:3000')
}.should raise_error(RuntimeError, "Identifier is invalid")
end
end
describe '.local_by_account_identifier' do describe '.local_by_account_identifier' do
it 'should find local users people' do it 'should find local users people' do
p = Person.local_by_account_identifier(user.diaspora_handle) p = Person.local_by_account_identifier(user.diaspora_handle)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter