RS IZ; removed validations on marshaling and removed key deletion on person destroyw

This commit is contained in:
ilya 2010-07-13 17:36:18 -07:00
parent 2862925e2d
commit 4a0bd5fc0c
7 changed files with 10 additions and 9 deletions

View file

@ -26,7 +26,7 @@ class Person
validates_true_for :url, :logic => lambda { self.url_unique?}
after_destroy :remove_all_traces, :remove_key
after_destroy :remove_all_traces#, :remove_key
scope :friends, where(:_type => "Person", :active => true)

View file

@ -44,8 +44,9 @@ class Post
end
#ENCRYPTION
before_validation :sign_if_mine
validates_true_for :owner_signature, :logic => lambda {self.verify_signature}
#validates_true_for :owner_signature, :logic => lambda {self.verify_signature}
key :owner_signature, String

View file

@ -4,7 +4,7 @@ class User < Person
:recoverable, :rememberable, :trackable, :validatable
before_validation_on_create :assign_key
before_create :assign_key
validates_presence_of :profile
before_validation :do_bad_things
@ -99,6 +99,7 @@ class User < Person
def generate_key
puts "Generating key"
puts paramstring
ctx = GPGME::Ctx.new
ctx.genkey(paramstring, nil, nil)

View file

@ -4,7 +4,7 @@ include ApplicationHelper
describe ApplicationHelper do
before do
@user = Factory.create(:user, :email => "robert@grimm.com")
@user = Factory.create(:user)
@person = Factory.create(:person)
end

View file

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe Diaspora::XML do
before do
@user = Factory.create(:user, :profile => { :first_name => "robert", :last_name => "grimm" } )
@user = Factory.create(:user)
Diaspora::XML::OWNER = @user
end

View file

@ -11,11 +11,8 @@ describe Request do
end
it 'should generate xml for the User as a Person' do
user = Factory.build(:user, :email => "rob@bob.com")
user = Factory.create(:user)
user.profile = Factory.create(:profile)
user.save(:validate => false)
user.profile.save
request = Request.instantiate(:to => "http://www.google.com/", :from => user)

View file

@ -30,6 +30,7 @@ describe 'user encryption' do
#end
it 'should remove the key from the keyring on person destroy' do
pending "We can implement deleting from the keyring later, its annoying to test b/c no stub any instance of"
person = Factory.create :person
keyid = person.key_fingerprint
original_key = person.export_key
@ -125,6 +126,7 @@ describe 'user encryption' do
xml.include?(message.owner_signature).should be true
end
it 'the signature should be verified on marshaling' do
pending "We're going to work on embeded profile"
message = Factory.build(:status_message, :person => @person)
message.owner_signature = GPGME.sign(message.signable_string, nil,