EM websocket cleanly merged with master. webfingering is now async

This commit is contained in:
maxwell 2010-10-24 18:21:01 -07:00
parent 58f836ab46
commit eddcb71fcb
6 changed files with 51 additions and 4 deletions

View file

@ -67,5 +67,4 @@ class RequestsController < ApplicationController
return
end
end
end
end

View file

@ -134,7 +134,6 @@ namespace :db do
task :tom_seed, :roles => :tom do
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"
sleep(20)
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/set_profile_photo"

View file

@ -14,6 +14,9 @@ class EMWebfinger
def fetch
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)
if person
process_callbacks person

View file

@ -53,8 +53,11 @@ describe RequestsController do
it 'should redirect to the page which you called it from ' do
pending "i need to figure out how to do this"
end
<<<<<<< HEAD
it 'should not blow up if there is a problem mid way thru the webfinger process' do
pending "i need to do this tomorrow
end
=======
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end

View file

@ -28,6 +28,10 @@ describe EMWebfinger do
let(:non_diaspora_hcard) {File.open(File.join(Rails.root, 'spec/fixtures/evan_hcard')).read}
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
it 'sets account ' do
@ -36,6 +40,7 @@ describe EMWebfinger do
end
it 'should raise an error on an unresonable email' do
<<<<<<< HEAD
proc{
EMWebfinger.new("joe.valid+email@my-address.com")
}.should_not raise_error(RuntimeError, "Identifier is invalid")
@ -47,6 +52,10 @@ describe EMWebfinger do
EMWebfinger.new('eviljoe@diaspora.local:3000')
}.should raise_error(RuntimeError, "Identifier is invalid")
end
=======
proc{EMWebfinger.new("asfadfasdf")}.should raise_error
end
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end
describe '#on_person' do
@ -112,6 +121,10 @@ describe EMWebfinger do
}
}
end
<<<<<<< HEAD
=======
>>>>>>> EM websocket cleanly merged with master. webfingering is now async
end
end
end

View file

@ -213,10 +213,40 @@ describe Person do
f = Person.by_account_identifier("tom@tom.joindiaspora.com")
f.should be nil
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
it 'should find local users people' do
p = Person.local_by_account_identifier(user.diaspora_handle)