Newer
Older
# licensed under the Affero General Public License version 3 or later. See
Daniel Vincent Grippi
a validé
describe 'user encryption' do
it 'should receive and marshal a public key from a request' do
remote_user = Factory.build(:user)
remote_user.encryption_key.nil?.should== false
deliverable = Object.new
deliverable.stub!(:deliver)
Notifier.stub!(:new_request).and_return(deliverable)
Person.should_receive(:by_webfinger).and_return(remote_user.person)
#should move this to friend request, but i found it here
Raphael
a validé
original_key = remote_user.exported_key
request = remote_user.send_friend_request_to(
xml = remote_user.salmon(request).xml_for(@user)
person_count = Person.all.count
@user.receive_salmon xml
Person.all.count.should == person_count + 1
new_person = Person.first(:id => id)
Raphael
a validé
new_person.exported_key.should == original_key
Raphael
a validé
it 'should encrypt a string' do
string = "Secretsauce"
ciphertext = @user.encrypt string
ciphertext.include?(string).should be false
@user.decrypt(ciphertext).should == string