parent
1c2e2f560d
commit
5ebda543a1
71 changed files with 209 additions and 273 deletions
|
|
@ -47,7 +47,6 @@ module DiasporaFederation
|
||||||
|
|
||||||
# @!attribute [r] nickname
|
# @!attribute [r] nickname
|
||||||
# the first part of the diaspora ID
|
# the first part of the diaspora ID
|
||||||
# @see Entities::Person#diaspora_id
|
|
||||||
# @return [String] nickname
|
# @return [String] nickname
|
||||||
property :nickname
|
property :nickname
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::AccountDeletionValidator
|
# @see Validators::AccountDeletionValidator
|
||||||
class AccountDeletion < Entity
|
class AccountDeletion < Entity
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the deleted account
|
# The diaspora ID of the deleted account
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
class Comment < Entity
|
class Comment < Entity
|
||||||
# old signature order
|
# old signature order
|
||||||
# @deprecated
|
# @deprecated
|
||||||
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid text diaspora_id).freeze
|
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid text author).freeze
|
||||||
|
|
||||||
include Relayable
|
include Relayable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,16 @@ module DiasporaFederation
|
||||||
# @return [[Entities::Message]] Messages of this conversation
|
# @return [[Entities::Message]] Messages of this conversation
|
||||||
entity :messages, [Entities::Message]
|
entity :messages, [Entities::Message]
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person initiated the conversation.
|
# The diaspora ID of the person initiated the conversation.
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] participant_ids
|
# @!attribute [r] participants
|
||||||
# The diaspora IDs of the persons participating the conversation separated by ";".
|
# The diaspora IDs of the persons participating the conversation separated by ";".
|
||||||
# @see Person#diaspora_id
|
|
||||||
# @return [String] participants diaspora IDs
|
# @return [String] participants diaspora IDs
|
||||||
property :participant_ids, xml_name: :participant_handles
|
property :participants, xml_name: :participant_handles
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
class Like < Entity
|
class Like < Entity
|
||||||
# old signature order
|
# old signature order
|
||||||
# @deprecated
|
# @deprecated
|
||||||
LEGACY_SIGNATURE_ORDER = %i(positive guid parent_type parent_guid diaspora_id).freeze
|
LEGACY_SIGNATURE_ORDER = %i(positive guid parent_type parent_guid author).freeze
|
||||||
|
|
||||||
include Relayable
|
include Relayable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
class Message < Entity
|
class Message < Entity
|
||||||
# old signature order
|
# old signature order
|
||||||
# @deprecated
|
# @deprecated
|
||||||
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid text created_at diaspora_id conversation_guid).freeze
|
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid text created_at author conversation_guid).freeze
|
||||||
|
|
||||||
include Relayable
|
include Relayable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
class Participation < Entity
|
class Participation < Entity
|
||||||
# old signature order
|
# old signature order
|
||||||
# @deprecated
|
# @deprecated
|
||||||
LEGACY_SIGNATURE_ORDER = %i(guid parent_type parent_guid diaspora_id).freeze
|
LEGACY_SIGNATURE_ORDER = %i(guid parent_type parent_guid author).freeze
|
||||||
|
|
||||||
include Relayable
|
include Relayable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ module DiasporaFederation
|
||||||
# @return [String] guid
|
# @return [String] guid
|
||||||
property :guid
|
property :guid
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person
|
# The diaspora ID of the person
|
||||||
# @see Validation::Rule::DiasporaId
|
# @see Validation::Rule::DiasporaId
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] url
|
# @!attribute [r] url
|
||||||
# @see Discovery::WebFinger#seed_url
|
# @see Discovery::WebFinger#seed_url
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ module DiasporaFederation
|
||||||
# @return [String] guid
|
# @return [String] guid
|
||||||
property :guid
|
property :guid
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person who uploaded the photo
|
# The diaspora ID of the person who uploaded the photo
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] author diaspora ID
|
# @return [String] author diaspora ID
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] public
|
# @!attribute [r] public
|
||||||
# Points if the photo is visible to everyone or only to some aspects
|
# Points if the photo is visible to everyone or only to some aspects
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
class PollParticipation < Entity
|
class PollParticipation < Entity
|
||||||
# old signature order
|
# old signature order
|
||||||
# @deprecated
|
# @deprecated
|
||||||
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid diaspora_id poll_answer_guid).freeze
|
LEGACY_SIGNATURE_ORDER = %i(guid parent_guid author poll_answer_guid).freeze
|
||||||
|
|
||||||
include Relayable
|
include Relayable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::ProfileValidator
|
# @see Validators::ProfileValidator
|
||||||
class Profile < Entity
|
class Profile < Entity
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person
|
# The diaspora ID of the person
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] first_name
|
# @!attribute [r] first_name
|
||||||
# @deprecated We decided to only use one name field, these should be removed
|
# @deprecated We decided to only use one name field, these should be removed
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ module DiasporaFederation
|
||||||
|
|
||||||
# on inclusion of this module the required properties for a relayable are added to the object that includes it
|
# on inclusion of this module the required properties for a relayable are added to the object that includes it
|
||||||
#
|
#
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the author.
|
# The diaspora ID of the author.
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
#
|
#
|
||||||
# @!attribute [r] guid
|
# @!attribute [r] guid
|
||||||
|
|
@ -43,7 +43,7 @@ module DiasporaFederation
|
||||||
# @param [Entity] entity the entity in which it is included
|
# @param [Entity] entity the entity in which it is included
|
||||||
def self.included(entity)
|
def self.included(entity)
|
||||||
entity.class_eval do
|
entity.class_eval do
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
property :author, xml_name: :diaspora_handle
|
||||||
property :guid
|
property :guid
|
||||||
property :parent_guid
|
property :parent_guid
|
||||||
property :author_signature, default: nil
|
property :author_signature, default: nil
|
||||||
|
|
@ -59,10 +59,10 @@ module DiasporaFederation
|
||||||
def to_signed_h
|
def to_signed_h
|
||||||
to_h.tap do |hash|
|
to_h.tap do |hash|
|
||||||
if author_signature.nil?
|
if author_signature.nil?
|
||||||
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, diaspora_id)
|
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, author)
|
||||||
raise AuthorPrivateKeyNotFound, "author=#{diaspora_id} guid=#{guid}" if privkey.nil?
|
raise AuthorPrivateKeyNotFound, "author=#{author} guid=#{guid}" if privkey.nil?
|
||||||
hash[:author_signature] = sign_with_key(privkey, hash)
|
hash[:author_signature] = sign_with_key(privkey, hash)
|
||||||
logger.info "event=sign status=complete signature=author_signature author=#{diaspora_id} guid=#{guid}"
|
logger.info "event=sign status=complete signature=author_signature author=#{author} guid=#{guid}"
|
||||||
end
|
end
|
||||||
|
|
||||||
try_sign_with_parent_author(hash) if parent_author_signature.nil?
|
try_sign_with_parent_author(hash) if parent_author_signature.nil?
|
||||||
|
|
@ -85,8 +85,8 @@ module DiasporaFederation
|
||||||
# verifies the signatures (+author_signature+ and +parent_author_signature+ if needed)
|
# verifies the signatures (+author_signature+ and +parent_author_signature+ if needed)
|
||||||
# @raise [SignatureVerificationFailed] if the signature is not valid or no public key is found
|
# @raise [SignatureVerificationFailed] if the signature is not valid or no public key is found
|
||||||
def verify_signatures
|
def verify_signatures
|
||||||
pubkey = DiasporaFederation.callbacks.trigger(:fetch_public_key_by_diaspora_id, diaspora_id)
|
pubkey = DiasporaFederation.callbacks.trigger(:fetch_public_key_by_diaspora_id, author)
|
||||||
raise PublicKeyNotFound, "author_signature author=#{diaspora_id} guid=#{guid}" if pubkey.nil?
|
raise PublicKeyNotFound, "author_signature author=#{author} guid=#{guid}" if pubkey.nil?
|
||||||
raise SignatureVerificationFailed, "wrong author_signature" unless verify_signature(pubkey, author_signature)
|
raise SignatureVerificationFailed, "wrong author_signature" unless verify_signature(pubkey, author_signature)
|
||||||
|
|
||||||
parent_author_local = DiasporaFederation.callbacks.trigger(:entity_author_is_local?, parent_type, parent_guid)
|
parent_author_local = DiasporaFederation.callbacks.trigger(:entity_author_is_local?, parent_type, parent_guid)
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ module DiasporaFederation
|
||||||
# @return [String] target type
|
# @return [String] target type
|
||||||
property :target_type
|
property :target_type
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person who deletes a relayable
|
# The diaspora ID of the person who deletes a relayable
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :sender_handle
|
property :author, xml_name: :sender_handle
|
||||||
|
|
||||||
# @!attribute [r] target_author_signature
|
# @!attribute [r] target_author_signature
|
||||||
# Contains a signature of the entity using the private key of the
|
# Contains a signature of the entity using the private key of the
|
||||||
|
|
@ -71,7 +71,7 @@ module DiasporaFederation
|
||||||
# @return [Hash] entity data hash with updated signatures
|
# @return [Hash] entity data hash with updated signatures
|
||||||
def to_h
|
def to_h
|
||||||
target_author = DiasporaFederation.callbacks.trigger(:fetch_entity_author_id_by_guid, target_type, target_guid)
|
target_author = DiasporaFederation.callbacks.trigger(:fetch_entity_author_id_by_guid, target_type, target_guid)
|
||||||
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, diaspora_id)
|
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, author)
|
||||||
|
|
||||||
super.tap do |hash|
|
super.tap do |hash|
|
||||||
fill_required_signature(target_author, privkey, hash) unless privkey.nil?
|
fill_required_signature(target_author, privkey, hash) unless privkey.nil?
|
||||||
|
|
@ -81,7 +81,7 @@ module DiasporaFederation
|
||||||
# use only {Retraction} for receive
|
# use only {Retraction} for receive
|
||||||
# @return [Retraction] instance as normal retraction
|
# @return [Retraction] instance as normal retraction
|
||||||
def to_retraction
|
def to_retraction
|
||||||
Retraction.new(diaspora_id: diaspora_id, target_guid: target_guid, target_type: target_type)
|
Retraction.new(author: author, target_guid: target_guid, target_type: target_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
@ -90,9 +90,9 @@ module DiasporaFederation
|
||||||
# @param [OpenSSL::PKey::RSA] privkey private key of sender
|
# @param [OpenSSL::PKey::RSA] privkey private key of sender
|
||||||
# @param [Hash] hash hash given for a signing
|
# @param [Hash] hash hash given for a signing
|
||||||
def fill_required_signature(target_author, privkey, hash)
|
def fill_required_signature(target_author, privkey, hash)
|
||||||
if target_author == diaspora_id && target_author_signature.nil?
|
if target_author == author && target_author_signature.nil?
|
||||||
hash[:target_author_signature] = SignedRetraction.sign_with_key(privkey, self)
|
hash[:target_author_signature] = SignedRetraction.sign_with_key(privkey, self)
|
||||||
elsif target_author != diaspora_id && parent_author_signature.nil?
|
elsif target_author != author && parent_author_signature.nil?
|
||||||
hash[:parent_author_signature] = SignedRetraction.sign_with_key(privkey, self)
|
hash[:parent_author_signature] = SignedRetraction.sign_with_key(privkey, self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::RequestValidator
|
# @see Validators::RequestValidator
|
||||||
class Request < Entity
|
class Request < Entity
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person who shares his profile
|
# The diaspora ID of the person who shares his profile
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] sender ID
|
# @return [String] sender ID
|
||||||
property :diaspora_id, xml_name: :sender_handle
|
property :author, xml_name: :sender_handle
|
||||||
|
|
||||||
# @!attribute [r] recipient_id
|
# @!attribute [r] recipient
|
||||||
# The diaspora ID of the person who will be shared with
|
# The diaspora ID of the person who will be shared with
|
||||||
# @see Person#diaspora_id
|
# @see Validation::Rule::DiasporaId
|
||||||
# @return [String] recipient ID
|
# @return [String] recipient ID
|
||||||
property :recipient_id, xml_name: :recipient_handle
|
property :recipient, xml_name: :recipient_handle
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::ReshareValidator
|
# @see Validators::ReshareValidator
|
||||||
class Reshare < Entity
|
class Reshare < Entity
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] root_author
|
||||||
# The diaspora ID of the person who posted the original post
|
# The diaspora ID of the person who posted the original post
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :root_diaspora_id # inconsistent, everywhere else it's "handle"
|
property :root_author, xml_name: :root_diaspora_id
|
||||||
|
|
||||||
# @!attribute [r] root_guid
|
# @!attribute [r] root_guid
|
||||||
# guid of the original post
|
# guid of the original post
|
||||||
|
|
@ -16,6 +16,12 @@ module DiasporaFederation
|
||||||
# @return [String] root guid
|
# @return [String] root guid
|
||||||
property :root_guid
|
property :root_guid
|
||||||
|
|
||||||
|
# @!attribute [r] author
|
||||||
|
# The diaspora ID of the person who reshares a post
|
||||||
|
# @see Person#author
|
||||||
|
# @return [String] diaspora ID
|
||||||
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] guid
|
# @!attribute [r] guid
|
||||||
# a random string of at least 16 chars.
|
# a random string of at least 16 chars.
|
||||||
# @see Validation::Rule::Guid
|
# @see Validation::Rule::Guid
|
||||||
|
|
@ -23,12 +29,6 @@ module DiasporaFederation
|
||||||
# @return [String] guid
|
# @return [String] guid
|
||||||
property :guid
|
property :guid
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
|
||||||
# The diaspora ID of the person who reshares a post
|
|
||||||
# @see Person#diaspora_id
|
|
||||||
# @return [String] diaspora ID
|
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
|
||||||
|
|
||||||
# @!attribute [r] public
|
# @!attribute [r] public
|
||||||
# has no meaning at the moment
|
# has no meaning at the moment
|
||||||
# @return [Boolean] public
|
# @return [Boolean] public
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::RetractionValidator
|
# @see Validators::RetractionValidator
|
||||||
class Retraction < Entity
|
class Retraction < Entity
|
||||||
|
# @!attribute [r] author
|
||||||
|
# The diaspora ID of the person who deletes the entity
|
||||||
|
# @see Person#author
|
||||||
|
# @return [String] diaspora ID
|
||||||
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
# @!attribute [r] target_guid
|
# @!attribute [r] target_guid
|
||||||
# guid of the entity to be deleted
|
# guid of the entity to be deleted
|
||||||
# @return [String] target guid
|
# @return [String] target guid
|
||||||
property :target_guid, xml_name: :post_guid
|
property :target_guid, xml_name: :post_guid
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
|
||||||
# The diaspora ID of the person who deletes the entity
|
|
||||||
# @see Person#diaspora_id
|
|
||||||
# @return [String] diaspora ID
|
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
|
||||||
|
|
||||||
# @!attribute [r] target_type
|
# @!attribute [r] target_type
|
||||||
# A string describing the type of the target.
|
# A string describing the type of the target.
|
||||||
# @return [String] target type
|
# @return [String] target type
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ module DiasporaFederation
|
||||||
# @return [String] target type
|
# @return [String] target type
|
||||||
property :target_type
|
property :target_type
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
# @!attribute [r] author
|
||||||
# The diaspora ID of the person who deletes a post
|
# The diaspora ID of the person who deletes a post
|
||||||
# @see Person#diaspora_id
|
# @see Person#author
|
||||||
# @return [String] diaspora ID
|
# @return [String] diaspora ID
|
||||||
property :diaspora_id, xml_name: :sender_handle
|
property :author, xml_name: :sender_handle
|
||||||
|
|
||||||
# @!attribute [r] author_signature
|
# @!attribute [r] author_signature
|
||||||
# Contains a signature of the entity using the private key of the author of a post
|
# Contains a signature of the entity using the private key of the author of a post
|
||||||
|
|
@ -47,7 +47,7 @@ module DiasporaFederation
|
||||||
def to_h
|
def to_h
|
||||||
super.tap do |hash|
|
super.tap do |hash|
|
||||||
if target_author_signature.nil?
|
if target_author_signature.nil?
|
||||||
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, diaspora_id)
|
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key_by_diaspora_id, author)
|
||||||
hash[:target_author_signature] = SignedRetraction.sign_with_key(privkey, self) unless privkey.nil?
|
hash[:target_author_signature] = SignedRetraction.sign_with_key(privkey, self) unless privkey.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -56,7 +56,7 @@ module DiasporaFederation
|
||||||
# use only {Retraction} for receive
|
# use only {Retraction} for receive
|
||||||
# @return [Retraction] instance as normal retraction
|
# @return [Retraction] instance as normal retraction
|
||||||
def to_retraction
|
def to_retraction
|
||||||
Retraction.new(diaspora_id: diaspora_id, target_guid: target_guid, target_type: target_type)
|
Retraction.new(author: author, target_guid: target_guid, target_type: target_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create signature for a retraction
|
# Create signature for a retraction
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,18 @@ module DiasporaFederation
|
||||||
#
|
#
|
||||||
# @see Validators::StatusMessageValidator
|
# @see Validators::StatusMessageValidator
|
||||||
class StatusMessage < Entity
|
class StatusMessage < Entity
|
||||||
|
# @!attribute [r] author
|
||||||
|
# The diaspora ID of the person who posts the status message
|
||||||
|
# @see Person#author
|
||||||
|
# @return [String] diaspora ID
|
||||||
|
property :author, xml_name: :diaspora_handle
|
||||||
|
|
||||||
|
# @!attribute [r] guid
|
||||||
|
# a random string of at least 16 chars.
|
||||||
|
# @see Validation::Rule::Guid
|
||||||
|
# @return [String] status message guid
|
||||||
|
property :guid
|
||||||
|
|
||||||
# @!attribute [r] raw_message
|
# @!attribute [r] raw_message
|
||||||
# text of the status message composed by the user
|
# text of the status message composed by the user
|
||||||
# @return [String] text of the status message
|
# @return [String] text of the status message
|
||||||
|
|
@ -24,18 +36,6 @@ module DiasporaFederation
|
||||||
# @return [Entities::Poll] poll
|
# @return [Entities::Poll] poll
|
||||||
entity :poll, Entities::Poll, default: nil
|
entity :poll, Entities::Poll, default: nil
|
||||||
|
|
||||||
# @!attribute [r] guid
|
|
||||||
# a random string of at least 16 chars.
|
|
||||||
# @see Validation::Rule::Guid
|
|
||||||
# @return [String] status message guid
|
|
||||||
property :guid
|
|
||||||
|
|
||||||
# @!attribute [r] diaspora_id
|
|
||||||
# The diaspora ID of the person who posts the status message
|
|
||||||
# @see Person#diaspora_id
|
|
||||||
# @return [String] diaspora ID
|
|
||||||
property :diaspora_id, xml_name: :diaspora_handle
|
|
||||||
|
|
||||||
# @!attribute [r] public
|
# @!attribute [r] public
|
||||||
# shows whether the status message is visible to everyone or only to some aspects
|
# shows whether the status message is visible to everyone or only to some aspects
|
||||||
# @return [Boolean] is it public
|
# @return [Boolean] is it public
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,16 @@ module DiasporaFederation
|
||||||
|
|
||||||
factory :person_entity, class: DiasporaFederation::Entities::Person do
|
factory :person_entity, class: DiasporaFederation::Entities::Person do
|
||||||
guid
|
guid
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
url "http://localhost:3000/"
|
url "http://localhost:3000/"
|
||||||
exported_key { generate(:public_key) }
|
exported_key { generate(:public_key) }
|
||||||
profile {
|
profile {
|
||||||
FactoryGirl.build(:profile_entity, diaspora_id: diaspora_id)
|
FactoryGirl.build(:profile_entity, author: author)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :profile_entity, class: DiasporaFederation::Entities::Profile do
|
factory :profile_entity, class: DiasporaFederation::Entities::Profile do
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
first_name "my name"
|
first_name "my name"
|
||||||
last_name nil
|
last_name nil
|
||||||
image_url "/assets/user/default.png"
|
image_url "/assets/user/default.png"
|
||||||
|
|
@ -74,7 +74,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
factory :photo_entity, class: DiasporaFederation::Entities::Photo do
|
factory :photo_entity, class: DiasporaFederation::Entities::Photo do
|
||||||
guid
|
guid
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
public(true)
|
public(true)
|
||||||
created_at { Time.now.utc }
|
created_at { Time.now.utc }
|
||||||
remote_photo_path "https://diaspora.example.tld/uploads/images/"
|
remote_photo_path "https://diaspora.example.tld/uploads/images/"
|
||||||
|
|
@ -91,84 +91,84 @@ module DiasporaFederation
|
||||||
|
|
||||||
factory :participation_entity,
|
factory :participation_entity,
|
||||||
class: DiasporaFederation::Entities::Participation, parent: :relayable_entity do
|
class: DiasporaFederation::Entities::Participation, parent: :relayable_entity do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
parent_type "Post"
|
parent_type "Post"
|
||||||
diaspora_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do
|
factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do
|
||||||
raw_message "i am a very interesting status update"
|
raw_message "i am a very interesting status update"
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
diaspora_id
|
|
||||||
public(true)
|
public(true)
|
||||||
created_at { Time.now.utc }
|
created_at { Time.now.utc }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :request_entity, class: DiasporaFederation::Entities::Request do
|
factory :request_entity, class: DiasporaFederation::Entities::Request do
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
recipient_id { generate(:diaspora_id) }
|
recipient { generate(:diaspora_id) }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :comment_entity, class: DiasporaFederation::Entities::Comment, parent: :relayable_entity do
|
factory :comment_entity, class: DiasporaFederation::Entities::Comment, parent: :relayable_entity do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
text "this is a very informative comment"
|
text "this is a very informative comment"
|
||||||
diaspora_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :like_entity, class: DiasporaFederation::Entities::Like, parent: :relayable_entity do
|
factory :like_entity, class: DiasporaFederation::Entities::Like, parent: :relayable_entity do
|
||||||
positive true
|
positive true
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
parent_type "Post"
|
parent_type "Post"
|
||||||
diaspora_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :account_deletion_entity, class: DiasporaFederation::Entities::AccountDeletion do
|
factory :account_deletion_entity, class: DiasporaFederation::Entities::AccountDeletion do
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :conversation_entity, class: DiasporaFederation::Entities::Conversation do
|
factory :conversation_entity, class: DiasporaFederation::Entities::Conversation do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
subject "this is a very informative subject"
|
subject "this is a very informative subject"
|
||||||
created_at { Time.now.utc }
|
created_at { Time.now.utc }
|
||||||
messages []
|
messages []
|
||||||
diaspora_id
|
participants { Array.new(3) { generate(:diaspora_id) }.join(";") }
|
||||||
participant_ids { Array.new(3) { generate(:diaspora_id) }.join(";") }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :message_entity, class: DiasporaFederation::Entities::Message, parent: :relayable_entity do
|
factory :message_entity, class: DiasporaFederation::Entities::Message, parent: :relayable_entity do
|
||||||
guid
|
guid
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
text "this is a very informative text"
|
text "this is a very informative text"
|
||||||
created_at { Time.now.utc }
|
created_at { Time.now.utc }
|
||||||
diaspora_id
|
|
||||||
conversation_guid { generate(:guid) }
|
conversation_guid { generate(:guid) }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :relayable_retraction_entity, class: DiasporaFederation::Entities::RelayableRetraction do
|
factory :relayable_retraction_entity, class: DiasporaFederation::Entities::RelayableRetraction do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
target_guid { generate(:guid) }
|
target_guid { generate(:guid) }
|
||||||
target_type "Comment"
|
target_type "Comment"
|
||||||
diaspora_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :reshare_entity, class: DiasporaFederation::Entities::Reshare do
|
factory :reshare_entity, class: DiasporaFederation::Entities::Reshare do
|
||||||
root_diaspora_id { generate(:diaspora_id) }
|
root_author { generate(:diaspora_id) }
|
||||||
root_guid { generate(:guid) }
|
root_guid { generate(:guid) }
|
||||||
guid
|
guid
|
||||||
diaspora_id
|
author { generate(:diaspora_id) }
|
||||||
public(true)
|
public(true)
|
||||||
created_at { Time.now.utc }
|
created_at { Time.now.utc }
|
||||||
provider_display_name { "the testsuite" }
|
provider_display_name { "the testsuite" }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :retraction_entity, class: DiasporaFederation::Entities::Retraction do
|
factory :retraction_entity, class: DiasporaFederation::Entities::Retraction do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
target_guid { generate(:guid) }
|
target_guid { generate(:guid) }
|
||||||
diaspora_id
|
|
||||||
target_type "Post"
|
target_type "Post"
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :signed_retraction_entity, class: DiasporaFederation::Entities::SignedRetraction do
|
factory :signed_retraction_entity, class: DiasporaFederation::Entities::SignedRetraction do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
target_guid { generate(:guid) }
|
target_guid { generate(:guid) }
|
||||||
target_type "Post"
|
target_type "Post"
|
||||||
diaspora_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_answer_entity, class: DiasporaFederation::Entities::PollAnswer do
|
factory :poll_answer_entity, class: DiasporaFederation::Entities::PollAnswer do
|
||||||
|
|
@ -184,8 +184,8 @@ module DiasporaFederation
|
||||||
|
|
||||||
factory :poll_participation_entity,
|
factory :poll_participation_entity,
|
||||||
class: DiasporaFederation::Entities::PollParticipation, parent: :relayable_entity do
|
class: DiasporaFederation::Entities::PollParticipation, parent: :relayable_entity do
|
||||||
|
author { generate(:diaspora_id) }
|
||||||
guid
|
guid
|
||||||
diaspora_id
|
|
||||||
poll_answer_guid { generate(:guid) }
|
poll_answer_guid { generate(:guid) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
class AccountDeletionValidator < Validation::Validator
|
class AccountDeletionValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,10 @@ module DiasporaFederation
|
||||||
class CommentValidator < Validation::Validator
|
class CommentValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
|
||||||
|
|
||||||
include RelayableValidator
|
include RelayableValidator
|
||||||
|
|
||||||
rule :text, [:not_empty,
|
rule :text, [:not_empty,
|
||||||
length: {maximum: 65_535}]
|
length: {maximum: 65_535}]
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ module DiasporaFederation
|
||||||
|
|
||||||
rule :guid, :guid
|
rule :guid, :guid
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :participant_ids, diaspora_id_count: {maximum: 20}
|
rule :participants, diaspora_id_count: {maximum: 20}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,9 @@ module DiasporaFederation
|
||||||
class LikeValidator < Validation::Validator
|
class LikeValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
|
||||||
|
|
||||||
rule :parent_type, [:not_empty, regular_expression: {regex: /\A(Post|Comment)\z/}]
|
|
||||||
|
|
||||||
include RelayableValidator
|
include RelayableValidator
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :parent_type, [:not_empty, regular_expression: {regex: /\A(Post|Comment)\z/}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,8 @@ module DiasporaFederation
|
||||||
class MessageValidator < Validation::Validator
|
class MessageValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
|
||||||
|
|
||||||
include RelayableValidator
|
include RelayableValidator
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
|
||||||
|
|
||||||
rule :conversation_guid, :guid
|
rule :conversation_guid, :guid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,9 @@ module DiasporaFederation
|
||||||
class ParticipationValidator < Validation::Validator
|
class ParticipationValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
|
||||||
|
|
||||||
rule :parent_type, [:not_empty, regular_expression: {regex: /\APost\z/}]
|
|
||||||
|
|
||||||
include RelayableValidator
|
include RelayableValidator
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :parent_type, [:not_empty, regular_expression: {regex: /\APost\z/}]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
rule :guid, :guid
|
rule :guid, :guid
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :url, %i(not_nil URI)
|
rule :url, %i(not_nil URI)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
rule :guid, :guid
|
rule :guid, :guid
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :public, :boolean
|
rule :public, :boolean
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,8 @@ module DiasporaFederation
|
||||||
class PollParticipationValidator < Validation::Validator
|
class PollParticipationValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
|
||||||
|
|
||||||
include RelayableValidator
|
include RelayableValidator
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
|
||||||
|
|
||||||
rule :poll_answer_guid, :guid
|
rule :poll_answer_guid, :guid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
class ProfileValidator < Validation::Validator
|
class ProfileValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :diaspora_id, :diaspora_id
|
rule :author, :diaspora_id
|
||||||
|
|
||||||
# the name must not contain a semicolon because of mentions
|
# the name must not contain a semicolon because of mentions
|
||||||
# @{<full_name> ; <diaspora_id>}
|
# @{<full_name> ; <diaspora_id>}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
rule :target_type, :not_empty
|
rule :target_type, :not_empty
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ module DiasporaFederation
|
||||||
# @param [Validation::Validator] validator the validator in which it is included
|
# @param [Validation::Validator] validator the validator in which it is included
|
||||||
def self.included(validator)
|
def self.included(validator)
|
||||||
validator.class_eval do
|
validator.class_eval do
|
||||||
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
rule :guid, :guid
|
||||||
rule :parent_guid, :guid
|
rule :parent_guid, :guid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ module DiasporaFederation
|
||||||
class RequestValidator < Validation::Validator
|
class RequestValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
rule :recipient_id, %i(not_empty diaspora_id)
|
rule :recipient, %i(not_empty diaspora_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ module DiasporaFederation
|
||||||
class ReshareValidator < Validation::Validator
|
class ReshareValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :root_diaspora_id, %i(not_empty diaspora_id)
|
rule :root_author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :root_guid, :guid
|
rule :root_guid, :guid
|
||||||
|
|
||||||
rule :guid, :guid
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :guid, :guid
|
||||||
|
|
||||||
rule :public, :boolean
|
rule :public, :boolean
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ module DiasporaFederation
|
||||||
class RetractionValidator < Validation::Validator
|
class RetractionValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :target_guid, :guid
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :target_guid, :guid
|
||||||
|
|
||||||
rule :target_type, :not_empty
|
rule :target_type, :not_empty
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
rule :target_type, :not_empty
|
rule :target_type, :not_empty
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :author, %i(not_empty diaspora_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ module DiasporaFederation
|
||||||
class StatusMessageValidator < Validation::Validator
|
class StatusMessageValidator < Validation::Validator
|
||||||
include Validation
|
include Validation
|
||||||
|
|
||||||
rule :guid, :guid
|
rule :author, %i(not_empty diaspora_id)
|
||||||
|
|
||||||
rule :diaspora_id, %i(not_empty diaspora_id)
|
rule :guid, :guid
|
||||||
|
|
||||||
rule :public, :boolean
|
rule :public, :boolean
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<account_deletion>
|
<account_deletion>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
</account_deletion>
|
</account_deletion>
|
||||||
XML
|
XML
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
module DiasporaFederation
|
module DiasporaFederation
|
||||||
describe Entities::Comment do
|
describe Entities::Comment do
|
||||||
let(:parent) { FactoryGirl.create(:post, author: bob) }
|
let(:parent) { FactoryGirl.create(:post, author: bob) }
|
||||||
let(:data) {
|
let(:data) { FactoryGirl.build(:comment_entity, author: alice.diaspora_id, parent_guid: parent.guid).to_signed_h }
|
||||||
FactoryGirl.build(:comment_entity, diaspora_id: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
|
||||||
}
|
|
||||||
|
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<comment>
|
<comment>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<parent_guid>#{parent.guid}</parent_guid>
|
<parent_guid>#{parent.guid}</parent_guid>
|
||||||
<author_signature>#{data[:author_signature]}</author_signature>
|
<author_signature>#{data[:author_signature]}</author_signature>
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@ module DiasporaFederation
|
||||||
describe Entities::Conversation do
|
describe Entities::Conversation do
|
||||||
let(:parent) { FactoryGirl.create(:conversation, author: bob) }
|
let(:parent) { FactoryGirl.create(:conversation, author: bob) }
|
||||||
let(:signed_msg1) {
|
let(:signed_msg1) {
|
||||||
msg = FactoryGirl.build(:message_entity, diaspora_id: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
msg = FactoryGirl.build(:message_entity, author: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
||||||
Entities::Message.new(msg)
|
Entities::Message.new(msg)
|
||||||
}
|
}
|
||||||
let(:signed_msg2) {
|
let(:signed_msg2) {
|
||||||
msg = FactoryGirl.build(:message_entity, diaspora_id: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
msg = FactoryGirl.build(:message_entity, author: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
||||||
Entities::Message.new(msg)
|
Entities::Message.new(msg)
|
||||||
}
|
}
|
||||||
let(:data) {
|
let(:data) {
|
||||||
FactoryGirl.attributes_for(:conversation_entity).merge!(
|
FactoryGirl.attributes_for(:conversation_entity).merge!(
|
||||||
messages: [signed_msg1, signed_msg2],
|
messages: [signed_msg1, signed_msg2],
|
||||||
diaspora_id: bob.diaspora_id,
|
author: bob.diaspora_id,
|
||||||
guid: parent.guid,
|
guid: parent.guid,
|
||||||
participant_ids: "#{bob.diaspora_id};#{FactoryGirl.generate(:diaspora_id)}"
|
participants: "#{bob.diaspora_id};#{FactoryGirl.generate(:diaspora_id)}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,8 +25,8 @@ module DiasporaFederation
|
||||||
<subject>#{data[:subject]}</subject>
|
<subject>#{data[:subject]}</subject>
|
||||||
<created_at>#{data[:created_at]}</created_at>
|
<created_at>#{data[:created_at]}</created_at>
|
||||||
#{data[:messages].map {|a| a.to_xml.to_s.indent(2) }.join("\n")}
|
#{data[:messages].map {|a| a.to_xml.to_s.indent(2) }.join("\n")}
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<participant_handles>#{data[:participant_ids]}</participant_handles>
|
<participant_handles>#{data[:participants]}</participant_handles>
|
||||||
</conversation>
|
</conversation>
|
||||||
XML
|
XML
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
let(:data) {
|
let(:data) {
|
||||||
FactoryGirl.build(
|
FactoryGirl.build(
|
||||||
:like_entity,
|
:like_entity,
|
||||||
diaspora_id: alice.diaspora_id,
|
author: alice.diaspora_id,
|
||||||
parent_guid: parent.guid,
|
parent_guid: parent.guid,
|
||||||
parent_type: parent.entity_type
|
parent_type: parent.entity_type
|
||||||
).to_signed_h
|
).to_signed_h
|
||||||
|
|
@ -13,7 +13,7 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<like>
|
<like>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<parent_guid>#{parent.guid}</parent_guid>
|
<parent_guid>#{parent.guid}</parent_guid>
|
||||||
<author_signature>#{data[:author_signature]}</author_signature>
|
<author_signature>#{data[:author_signature]}</author_signature>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
module DiasporaFederation
|
module DiasporaFederation
|
||||||
describe Entities::Message do
|
describe Entities::Message do
|
||||||
let(:parent) { FactoryGirl.create(:conversation, author: bob) }
|
let(:parent) { FactoryGirl.create(:conversation, author: bob) }
|
||||||
let(:data) {
|
let(:data) { FactoryGirl.build(:message_entity, author: alice.diaspora_id, parent_guid: parent.guid).to_signed_h }
|
||||||
FactoryGirl.build(:message_entity, diaspora_id: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
|
||||||
}
|
|
||||||
|
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<message>
|
<message>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<parent_guid>#{parent.guid}</parent_guid>
|
<parent_guid>#{parent.guid}</parent_guid>
|
||||||
<author_signature>#{data[:author_signature]}</author_signature>
|
<author_signature>#{data[:author_signature]}</author_signature>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
let(:data) {
|
let(:data) {
|
||||||
FactoryGirl.build(
|
FactoryGirl.build(
|
||||||
:participation_entity,
|
:participation_entity,
|
||||||
diaspora_id: alice.diaspora_id,
|
author: alice.diaspora_id,
|
||||||
parent_guid: parent.guid,
|
parent_guid: parent.guid,
|
||||||
parent_type: parent.entity_type
|
parent_type: parent.entity_type
|
||||||
).to_signed_h
|
).to_signed_h
|
||||||
|
|
@ -13,7 +13,7 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<participation>
|
<participation>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<parent_guid>#{parent.guid}</parent_guid>
|
<parent_guid>#{parent.guid}</parent_guid>
|
||||||
<author_signature>#{data[:author_signature]}</author_signature>
|
<author_signature>#{data[:author_signature]}</author_signature>
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ module DiasporaFederation
|
||||||
<<-XML
|
<<-XML
|
||||||
<person>
|
<person>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<url>#{data[:url]}</url>
|
<url>#{data[:url]}</url>
|
||||||
<profile>
|
<profile>
|
||||||
<diaspora_handle>#{data[:profile].diaspora_id}</diaspora_handle>
|
<diaspora_handle>#{data[:profile].author}</diaspora_handle>
|
||||||
<first_name>#{data[:profile].first_name}</first_name>
|
<first_name>#{data[:profile].first_name}</first_name>
|
||||||
<last_name/>
|
<last_name/>
|
||||||
<image_url>#{data[:profile].image_url}</image_url>
|
<image_url>#{data[:profile].image_url}</image_url>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module DiasporaFederation
|
||||||
<<-XML
|
<<-XML
|
||||||
<photo>
|
<photo>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<public>#{data[:public]}</public>
|
<public>#{data[:public]}</public>
|
||||||
<created_at>#{data[:created_at]}</created_at>
|
<created_at>#{data[:created_at]}</created_at>
|
||||||
<remote_photo_path>#{data[:remote_photo_path]}</remote_photo_path>
|
<remote_photo_path>#{data[:remote_photo_path]}</remote_photo_path>
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,13 @@ module DiasporaFederation
|
||||||
describe Entities::PollParticipation do
|
describe Entities::PollParticipation do
|
||||||
let(:parent) { FactoryGirl.create(:poll, author: bob) }
|
let(:parent) { FactoryGirl.create(:poll, author: bob) }
|
||||||
let(:data) {
|
let(:data) {
|
||||||
FactoryGirl.build(
|
FactoryGirl.build(:poll_participation_entity, author: alice.diaspora_id, parent_guid: parent.guid).to_signed_h
|
||||||
:poll_participation_entity,
|
|
||||||
diaspora_id: alice.diaspora_id,
|
|
||||||
parent_guid: parent.guid
|
|
||||||
).to_signed_h
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<poll_participation>
|
<poll_participation>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<parent_guid>#{parent.guid}</parent_guid>
|
<parent_guid>#{parent.guid}</parent_guid>
|
||||||
<author_signature>#{data[:author_signature]}</author_signature>
|
<author_signature>#{data[:author_signature]}</author_signature>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<profile>
|
<profile>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<first_name>#{data[:first_name]}</first_name>
|
<first_name>#{data[:first_name]}</first_name>
|
||||||
<last_name/>
|
<last_name/>
|
||||||
<image_url>#{data[:image_url]}</image_url>
|
<image_url>#{data[:image_url]}</image_url>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
module DiasporaFederation
|
module DiasporaFederation
|
||||||
describe Entities::RelayableRetraction do
|
describe Entities::RelayableRetraction do
|
||||||
let(:data) { FactoryGirl.build(:relayable_retraction_entity, diaspora_id: alice.diaspora_id).to_h }
|
let(:data) { FactoryGirl.build(:relayable_retraction_entity, author: alice.diaspora_id).to_h }
|
||||||
|
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
|
|
@ -8,7 +8,7 @@ module DiasporaFederation
|
||||||
<parent_author_signature>#{data[:parent_author_signature]}</parent_author_signature>
|
<parent_author_signature>#{data[:parent_author_signature]}</parent_author_signature>
|
||||||
<target_guid>#{data[:target_guid]}</target_guid>
|
<target_guid>#{data[:target_guid]}</target_guid>
|
||||||
<target_type>#{data[:target_type]}</target_type>
|
<target_type>#{data[:target_type]}</target_type>
|
||||||
<sender_handle>#{data[:diaspora_id]}</sender_handle>
|
<sender_handle>#{data[:author]}</sender_handle>
|
||||||
<target_author_signature/>
|
<target_author_signature/>
|
||||||
</relayable_retraction>
|
</relayable_retraction>
|
||||||
XML
|
XML
|
||||||
|
|
@ -25,10 +25,10 @@ XML
|
||||||
it "updates author signature when it was nil and key was supplied" do
|
it "updates author signature when it was nil and key was supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_entity_author_id_by_guid, hash[:target_type], hash[:target_guid]
|
:fetch_entity_author_id_by_guid, hash[:target_type], hash[:target_guid]
|
||||||
).and_return(hash[:diaspora_id])
|
).and_return(hash[:author])
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, hash[:diaspora_id]
|
:fetch_private_key_by_diaspora_id, hash[:author]
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
||||||
|
|
@ -45,7 +45,7 @@ XML
|
||||||
).and_return(FactoryGirl.generate(:diaspora_id))
|
).and_return(FactoryGirl.generate(:diaspora_id))
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, hash[:diaspora_id]
|
:fetch_private_key_by_diaspora_id, hash[:author]
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
||||||
|
|
@ -64,12 +64,12 @@ XML
|
||||||
|
|
||||||
it "doesn't change signatures if keys weren't supplied" do
|
it "doesn't change signatures if keys weren't supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, hash[:diaspora_id]
|
:fetch_private_key_by_diaspora_id, hash[:author]
|
||||||
).and_return(nil)
|
).and_return(nil)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_entity_author_id_by_guid, "Comment", hash[:target_guid]
|
:fetch_entity_author_id_by_guid, "Comment", hash[:target_guid]
|
||||||
).and_return(hash[:diaspora_id])
|
).and_return(hash[:author])
|
||||||
|
|
||||||
signed_hash = Entities::RelayableRetraction.new(hash).to_h
|
signed_hash = Entities::RelayableRetraction.new(hash).to_h
|
||||||
expect(signed_hash[:target_author_signature]).to eq(nil)
|
expect(signed_hash[:target_author_signature]).to eq(nil)
|
||||||
|
|
@ -82,7 +82,7 @@ XML
|
||||||
retraction = relayable_retraction.to_retraction
|
retraction = relayable_retraction.to_retraction
|
||||||
|
|
||||||
expect(retraction).to be_a(Entities::Retraction)
|
expect(retraction).to be_a(Entities::Retraction)
|
||||||
expect(retraction.diaspora_id).to eq(relayable_retraction.diaspora_id)
|
expect(retraction.author).to eq(relayable_retraction.author)
|
||||||
expect(retraction.target_guid).to eq(relayable_retraction.target_guid)
|
expect(retraction.target_guid).to eq(relayable_retraction.target_guid)
|
||||||
expect(retraction.target_type).to eq(relayable_retraction.target_type)
|
expect(retraction.target_type).to eq(relayable_retraction.target_type)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ module DiasporaFederation
|
||||||
|
|
||||||
let(:guid) { FactoryGirl.generate(:guid) }
|
let(:guid) { FactoryGirl.generate(:guid) }
|
||||||
let(:parent_guid) { FactoryGirl.generate(:guid) }
|
let(:parent_guid) { FactoryGirl.generate(:guid) }
|
||||||
let(:diaspora_id) { FactoryGirl.generate(:diaspora_id) }
|
let(:author) { FactoryGirl.generate(:diaspora_id) }
|
||||||
let(:property) { "hello" }
|
let(:property) { "hello" }
|
||||||
let(:new_property) { "some text" }
|
let(:new_property) { "some text" }
|
||||||
let(:hash) { {guid: guid, diaspora_id: diaspora_id, parent_guid: parent_guid, property: property} }
|
let(:hash) { {guid: guid, author: author, parent_guid: parent_guid, property: property} }
|
||||||
|
|
||||||
let(:signature_data) { "#{diaspora_id};#{guid};#{parent_guid};#{property}" }
|
let(:signature_data) { "#{author};#{guid};#{parent_guid};#{property}" }
|
||||||
let(:signature_data_with_new_property) { "#{diaspora_id};#{guid};#{new_property};#{parent_guid};#{property}" }
|
let(:signature_data_with_new_property) { "#{author};#{guid};#{new_property};#{parent_guid};#{property}" }
|
||||||
let(:legacy_signature_data) { "#{guid};#{diaspora_id};#{property};#{parent_guid}" }
|
let(:legacy_signature_data) { "#{guid};#{author};#{property};#{parent_guid}" }
|
||||||
|
|
||||||
class SomeRelayable < Entity
|
class SomeRelayable < Entity
|
||||||
LEGACY_SIGNATURE_ORDER = %i(guid diaspora_id property parent_guid).freeze
|
LEGACY_SIGNATURE_ORDER = %i(guid author property parent_guid).freeze
|
||||||
|
|
||||||
include Entities::Relayable
|
include Entities::Relayable
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ module DiasporaFederation
|
||||||
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, legacy_signature_data)
|
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, legacy_signature_data)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -69,7 +69,7 @@ module DiasporaFederation
|
||||||
hash[:author_signature] = nil
|
hash[:author_signature] = nil
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
|
|
@ -81,7 +81,7 @@ module DiasporaFederation
|
||||||
hash[:author_signature] = sign_with_key(author_pkey, legacy_signature_data)
|
hash[:author_signature] = sign_with_key(author_pkey, legacy_signature_data)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -102,7 +102,7 @@ module DiasporaFederation
|
||||||
hash[:parent_author_signature] = nil
|
hash[:parent_author_signature] = nil
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -123,7 +123,7 @@ module DiasporaFederation
|
||||||
hash[:parent_author_signature] = nil
|
hash[:parent_author_signature] = nil
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -140,7 +140,7 @@ module DiasporaFederation
|
||||||
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, signature_data)
|
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, signature_data)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -160,7 +160,7 @@ module DiasporaFederation
|
||||||
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, signature_data_with_new_property)
|
signed_hash[:parent_author_signature] = sign_with_key(parent_pkey, signature_data_with_new_property)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -179,7 +179,7 @@ module DiasporaFederation
|
||||||
signed_hash[:author_signature] = sign_with_key(author_pkey, legacy_signature_data)
|
signed_hash[:author_signature] = sign_with_key(author_pkey, legacy_signature_data)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_public_key_by_diaspora_id, diaspora_id
|
:fetch_public_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey.public_key)
|
).and_return(author_pkey.public_key)
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
|
|
@ -192,7 +192,7 @@ module DiasporaFederation
|
||||||
describe "#to_signed_h" do
|
describe "#to_signed_h" do
|
||||||
it "updates signatures when they were nil and keys were supplied" do
|
it "updates signatures when they were nil and keys were supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, diaspora_id
|
:fetch_private_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -213,7 +213,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
it "raises when author_signature not set and key isn't supplied" do
|
it "raises when author_signature not set and key isn't supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, diaspora_id
|
:fetch_private_key_by_diaspora_id, author
|
||||||
).and_return(nil)
|
).and_return(nil)
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
|
|
@ -223,7 +223,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
it "doesn't set parent_author_signature if key isn't supplied" do
|
it "doesn't set parent_author_signature if key isn't supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, diaspora_id
|
:fetch_private_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
@ -259,7 +259,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
expected_xml = <<-XML
|
expected_xml = <<-XML
|
||||||
<some_relayable>
|
<some_relayable>
|
||||||
<diaspora_handle>#{diaspora_id}</diaspora_handle>
|
<diaspora_handle>#{author}</diaspora_handle>
|
||||||
<guid>#{guid}</guid>
|
<guid>#{guid}</guid>
|
||||||
<parent_guid>#{parent_guid}</parent_guid>
|
<parent_guid>#{parent_guid}</parent_guid>
|
||||||
<author_signature>aa</author_signature>
|
<author_signature>aa</author_signature>
|
||||||
|
|
@ -274,7 +274,7 @@ XML
|
||||||
|
|
||||||
it "computes correct signatures for the entity" do
|
it "computes correct signatures for the entity" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, diaspora_id
|
:fetch_private_key_by_diaspora_id, author
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<request>
|
<request>
|
||||||
<sender_handle>#{data[:diaspora_id]}</sender_handle>
|
<sender_handle>#{data[:author]}</sender_handle>
|
||||||
<recipient_handle>#{data[:recipient_id]}</recipient_handle>
|
<recipient_handle>#{data[:recipient]}</recipient_handle>
|
||||||
</request>
|
</request>
|
||||||
XML
|
XML
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<reshare>
|
<reshare>
|
||||||
<root_diaspora_id>#{data[:root_diaspora_id]}</root_diaspora_id>
|
<root_diaspora_id>#{data[:root_author]}</root_diaspora_id>
|
||||||
<root_guid>#{data[:root_guid]}</root_guid>
|
<root_guid>#{data[:root_guid]}</root_guid>
|
||||||
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<guid>#{data[:guid]}</guid>
|
<guid>#{data[:guid]}</guid>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
|
||||||
<public>#{data[:public]}</public>
|
<public>#{data[:public]}</public>
|
||||||
<created_at>#{data[:created_at]}</created_at>
|
<created_at>#{data[:created_at]}</created_at>
|
||||||
<provider_display_name>#{data[:provider_display_name]}</provider_display_name>
|
<provider_display_name>#{data[:provider_display_name]}</provider_display_name>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<retraction>
|
<retraction>
|
||||||
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
<post_guid>#{data[:target_guid]}</post_guid>
|
<post_guid>#{data[:target_guid]}</post_guid>
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
|
||||||
<type>#{data[:target_type]}</type>
|
<type>#{data[:target_type]}</type>
|
||||||
</retraction>
|
</retraction>
|
||||||
XML
|
XML
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
module DiasporaFederation
|
module DiasporaFederation
|
||||||
describe Entities::SignedRetraction do
|
describe Entities::SignedRetraction do
|
||||||
let(:data) { FactoryGirl.build(:signed_retraction_entity, diaspora_id: alice.diaspora_id).to_h }
|
let(:data) { FactoryGirl.build(:signed_retraction_entity, author: alice.diaspora_id).to_h }
|
||||||
|
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<signed_retraction>
|
<signed_retraction>
|
||||||
<target_guid>#{data[:target_guid]}</target_guid>
|
<target_guid>#{data[:target_guid]}</target_guid>
|
||||||
<target_type>#{data[:target_type]}</target_type>
|
<target_type>#{data[:target_type]}</target_type>
|
||||||
<sender_handle>#{data[:diaspora_id]}</sender_handle>
|
<sender_handle>#{data[:author]}</sender_handle>
|
||||||
<target_author_signature>#{data[:target_author_signature]}</target_author_signature>
|
<target_author_signature>#{data[:target_author_signature]}</target_author_signature>
|
||||||
</signed_retraction>
|
</signed_retraction>
|
||||||
XML
|
XML
|
||||||
|
|
@ -23,7 +23,7 @@ XML
|
||||||
|
|
||||||
it "updates author signature when it was nil and key was supplied" do
|
it "updates author signature when it was nil and key was supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, hash[:diaspora_id]
|
:fetch_private_key_by_diaspora_id, hash[:author]
|
||||||
).and_return(author_pkey)
|
).and_return(author_pkey)
|
||||||
|
|
||||||
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
signed_string = "#{hash[:target_guid]};#{hash[:target_type]}"
|
||||||
|
|
@ -44,7 +44,7 @@ XML
|
||||||
|
|
||||||
it "doesn't change signature if a key wasn't supplied" do
|
it "doesn't change signature if a key wasn't supplied" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
expect(DiasporaFederation.callbacks).to receive(:trigger).with(
|
||||||
:fetch_private_key_by_diaspora_id, hash[:diaspora_id]
|
:fetch_private_key_by_diaspora_id, hash[:author]
|
||||||
).and_return(nil)
|
).and_return(nil)
|
||||||
|
|
||||||
signed_hash = Entities::SignedRetraction.new(hash).to_h
|
signed_hash = Entities::SignedRetraction.new(hash).to_h
|
||||||
|
|
@ -58,7 +58,7 @@ XML
|
||||||
retraction = signed_retraction.to_retraction
|
retraction = signed_retraction.to_retraction
|
||||||
|
|
||||||
expect(retraction).to be_a(Entities::Retraction)
|
expect(retraction).to be_a(Entities::Retraction)
|
||||||
expect(retraction.diaspora_id).to eq(signed_retraction.diaspora_id)
|
expect(retraction.author).to eq(signed_retraction.author)
|
||||||
expect(retraction.target_guid).to eq(signed_retraction.target_guid)
|
expect(retraction.target_guid).to eq(signed_retraction.target_guid)
|
||||||
expect(retraction.target_type).to eq(signed_retraction.target_type)
|
expect(retraction.target_type).to eq(signed_retraction.target_type)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,12 @@ module DiasporaFederation
|
||||||
let(:xml) {
|
let(:xml) {
|
||||||
<<-XML
|
<<-XML
|
||||||
<status_message>
|
<status_message>
|
||||||
|
<diaspora_handle>#{data[:author]}</diaspora_handle>
|
||||||
|
<guid>#{data[:guid]}</guid>
|
||||||
<raw_message>#{data[:raw_message]}</raw_message>
|
<raw_message>#{data[:raw_message]}</raw_message>
|
||||||
<photo>
|
<photo>
|
||||||
<guid>#{photo1.guid}</guid>
|
<guid>#{photo1.guid}</guid>
|
||||||
<diaspora_handle>#{photo1.diaspora_id}</diaspora_handle>
|
<diaspora_handle>#{photo1.author}</diaspora_handle>
|
||||||
<public>#{photo1.public}</public>
|
<public>#{photo1.public}</public>
|
||||||
<created_at>#{photo1.created_at}</created_at>
|
<created_at>#{photo1.created_at}</created_at>
|
||||||
<remote_photo_path>#{photo1.remote_photo_path}</remote_photo_path>
|
<remote_photo_path>#{photo1.remote_photo_path}</remote_photo_path>
|
||||||
|
|
@ -30,7 +32,7 @@ module DiasporaFederation
|
||||||
</photo>
|
</photo>
|
||||||
<photo>
|
<photo>
|
||||||
<guid>#{photo2.guid}</guid>
|
<guid>#{photo2.guid}</guid>
|
||||||
<diaspora_handle>#{photo2.diaspora_id}</diaspora_handle>
|
<diaspora_handle>#{photo2.author}</diaspora_handle>
|
||||||
<public>#{photo2.public}</public>
|
<public>#{photo2.public}</public>
|
||||||
<created_at>#{photo2.created_at}</created_at>
|
<created_at>#{photo2.created_at}</created_at>
|
||||||
<remote_photo_path>#{photo2.remote_photo_path}</remote_photo_path>
|
<remote_photo_path>#{photo2.remote_photo_path}</remote_photo_path>
|
||||||
|
|
@ -45,8 +47,6 @@ module DiasporaFederation
|
||||||
<lat>#{location.lat}</lat>
|
<lat>#{location.lat}</lat>
|
||||||
<lng>#{location.lng}</lng>
|
<lng>#{location.lng}</lng>
|
||||||
</location>
|
</location>
|
||||||
<guid>#{data[:guid]}</guid>
|
|
||||||
<diaspora_handle>#{data[:diaspora_id]}</diaspora_handle>
|
|
||||||
<public>#{data[:public]}</public>
|
<public>#{data[:public]}</public>
|
||||||
<created_at>#{data[:created_at]}</created_at>
|
<created_at>#{data[:created_at]}</created_at>
|
||||||
<provider_display_name>#{data[:provider_display_name]}</provider_display_name>
|
<provider_display_name>#{data[:provider_display_name]}</provider_display_name>
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ XML
|
||||||
|
|
||||||
context "relayable signature verification feature support" do
|
context "relayable signature verification feature support" do
|
||||||
it "calls signatures verification on relayable unpack" do
|
it "calls signatures verification on relayable unpack" do
|
||||||
entity = FactoryGirl.build(:comment_entity, diaspora_id: alice.diaspora_id)
|
entity = FactoryGirl.build(:comment_entity, author: alice.diaspora_id)
|
||||||
payload = Salmon::XmlPayload.pack(entity)
|
payload = Salmon::XmlPayload.pack(entity)
|
||||||
payload.at_xpath("post/*[1]/author_signature").content = nil
|
payload.at_xpath("post/*[1]/author_signature").content = nil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,6 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a relayable validator"
|
it_behaves_like "a relayable validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
|
||||||
let(:property) { :diaspora_id }
|
|
||||||
let(:mandatory) { true }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#guid" do
|
|
||||||
it_behaves_like "a guid validator" do
|
|
||||||
let(:property) { :guid }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#text" do
|
describe "#text" do
|
||||||
it_behaves_like "a property with a value validation/restriction" do
|
it_behaves_like "a property with a value validation/restriction" do
|
||||||
let(:property) { :text }
|
let(:property) { :text }
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ module DiasporaFederation
|
||||||
describe "participant_ids" do
|
describe "participant_ids" do
|
||||||
# must not contain more than 20 participant handles
|
# must not contain more than 20 participant handles
|
||||||
it_behaves_like "a property with a value validation/restriction" do
|
it_behaves_like "a property with a value validation/restriction" do
|
||||||
let(:property) { :participant_ids }
|
let(:property) { :participants }
|
||||||
let(:wrong_values) { [Array.new(21) { FactoryGirl.generate(:diaspora_id) }.join(";")] }
|
let(:wrong_values) { [Array.new(21) { FactoryGirl.generate(:diaspora_id) }.join(";")] }
|
||||||
let(:correct_values) { [Array.new(20) { FactoryGirl.generate(:diaspora_id) }.join(";")] }
|
let(:correct_values) { [Array.new(20) { FactoryGirl.generate(:diaspora_id) }.join(";")] }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,6 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a relayable validator"
|
it_behaves_like "a relayable validator"
|
||||||
|
|
||||||
describe "#guid" do
|
|
||||||
it_behaves_like "a guid validator" do
|
|
||||||
let(:property) { :guid }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
|
||||||
let(:property) { :diaspora_id }
|
|
||||||
let(:mandatory) { true }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#parent_type" do
|
describe "#parent_type" do
|
||||||
it_behaves_like "a property with a value validation/restriction" do
|
it_behaves_like "a property with a value validation/restriction" do
|
||||||
let(:property) { :parent_type }
|
let(:property) { :parent_type }
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,9 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a relayable validator"
|
it_behaves_like "a relayable validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
describe "#conversation_guid" do
|
||||||
let(:property) { :diaspora_id }
|
it_behaves_like "a guid validator" do
|
||||||
let(:mandatory) { true }
|
let(:property) { :conversation_guid }
|
||||||
end
|
|
||||||
|
|
||||||
%i(guid conversation_guid).each do |prop|
|
|
||||||
describe "##{prop}" do
|
|
||||||
it_behaves_like "a guid validator" do
|
|
||||||
let(:property) { prop }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,6 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a relayable validator"
|
it_behaves_like "a relayable validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
|
||||||
let(:property) { :diaspora_id }
|
|
||||||
let(:mandatory) { true }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#guid" do
|
|
||||||
it_behaves_like "a guid validator" do
|
|
||||||
let(:property) { :guid }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#parent_type" do
|
describe "#parent_type" do
|
||||||
it_behaves_like "a property with a value validation/restriction" do
|
it_behaves_like "a property with a value validation/restriction" do
|
||||||
let(:property) { :parent_type }
|
let(:property) { :parent_type }
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,9 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a relayable validator"
|
it_behaves_like "a relayable validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
describe "#poll_answer_guid" do
|
||||||
let(:property) { :diaspora_id }
|
it_behaves_like "a guid validator" do
|
||||||
let(:mandatory) { true }
|
let(:property) { :poll_answer_guid }
|
||||||
end
|
|
||||||
|
|
||||||
%i(guid poll_answer_guid).each do |prop|
|
|
||||||
describe "##{prop}" do
|
|
||||||
it_behaves_like "a guid validator" do
|
|
||||||
let(:property) { prop }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { false }
|
let(:mandatory) { false }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
%i(diaspora_id recipient_id).each do |prop|
|
%i(author recipient).each do |prop|
|
||||||
describe "##{prop}" do
|
describe "##{prop}" do
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { prop }
|
let(:property) { prop }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ module DiasporaFederation
|
||||||
let(:entity) { :reshare_entity }
|
let(:entity) { :reshare_entity }
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
%i(root_diaspora_id diaspora_id).each do |prop|
|
%i(root_author author).each do |prop|
|
||||||
describe "##{prop}" do
|
describe "##{prop}" do
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { prop }
|
let(:property) { prop }
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ module DiasporaFederation
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ module DiasporaFederation
|
||||||
it_behaves_like "a common validator"
|
it_behaves_like "a common validator"
|
||||||
|
|
||||||
it_behaves_like "a diaspora id validator" do
|
it_behaves_like "a diaspora id validator" do
|
||||||
let(:property) { :diaspora_id }
|
let(:property) { :author }
|
||||||
let(:mandatory) { true }
|
let(:mandatory) { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,17 @@ shared_examples "a common validator" do
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples "a relayable validator" do
|
shared_examples "a relayable validator" do
|
||||||
|
it_behaves_like "a diaspora id validator" do
|
||||||
|
let(:property) { :author }
|
||||||
|
let(:mandatory) { true }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#guid" do
|
||||||
|
it_behaves_like "a guid validator" do
|
||||||
|
let(:property) { :guid }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#parent_guid" do
|
describe "#parent_guid" do
|
||||||
it_behaves_like "a guid validator" do
|
it_behaves_like "a guid validator" do
|
||||||
let(:property) { :parent_guid }
|
let(:property) { :parent_guid }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue