diaspora_federation-test 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0303f98534c6ab03def50f40594448c758e8b332
4
- data.tar.gz: 30b809afd2691f629aa30dbc8dbe519247db0ddc
3
+ metadata.gz: 58ecbabeb7e7a99873e81faa4f1bbb843eb552e4
4
+ data.tar.gz: 2e7161588ee220c786cced85fa11c26358af0578
5
5
  SHA512:
6
- metadata.gz: ca2a2c889b84ece782e0a6d15a626a458a5c1ba1713c471784eb137459335b48f6d42c302b75e320671d31273ddc10a14e3e45a30797e73a69a659cb4f267535
7
- data.tar.gz: b3aaa49256bcf620978acd0144167b01edd96c55a2b8f8d70c0fb187a74143b22b6999b466cc6ea3175779867294e6c902ba78ecaaf4c2f5b1a0385b260f3284
6
+ metadata.gz: f45ac94f3a5ac623a4aab921d4a67ff48bd43d359b36b696239abbf555349aaadda5b9b99f85d97c5f0ef8b50a6b89b6986a109925b08610fc72c6ebe8e164e3
7
+ data.tar.gz: b9ba391d10aa729f13df6b235688507a3b6a5b06746302147c03b3c7706061b517253403aa1423cd341d2e8409f1dc30f79bd7bb9400119f014475072b5b44d6
@@ -23,7 +23,7 @@ module DiasporaFederation
23
23
  def self.relayable_attributes_with_signatures(factory_name)
24
24
  klass = FactoryGirl.factory_by_name(factory_name).build_class
25
25
  sort_hash(FactoryGirl.attributes_for(factory_name), klass).tap do |data|
26
- DiasporaFederation::Entities::Relayable.update_signatures!(data)
26
+ DiasporaFederation::Entities::Relayable.update_signatures!(data, klass)
27
27
  end
28
28
  end
29
29
 
@@ -1,183 +1,193 @@
1
+ require "diaspora_federation"
1
2
  require "factory_girl"
2
3
 
3
- FactoryGirl.define do
4
- initialize_with { new(attributes) }
5
- sequence(:guid) { UUID.generate :compact }
6
- sequence(:diaspora_id) {|n| "person-#{n}-#{SecureRandom.hex(3)}@localhost:3000" }
7
- sequence(:public_key) { OpenSSL::PKey::RSA.generate(1024).public_key.export }
8
-
9
- factory :webfinger, class: DiasporaFederation::Discovery::WebFinger do
10
- guid
11
- acct_uri { "acct:#{generate(:diaspora_id)}" }
12
- alias_url "http://localhost:3000/people/0123456789abcdef"
13
- hcard_url "http://localhost:3000/hcard/users/user"
14
- seed_url "http://localhost:3000/"
15
- profile_url "http://localhost:3000/u/user"
16
- atom_url "http://localhost:3000/public/user.atom"
17
- salmon_url "http://localhost:3000/receive/users/0123456789abcdef"
18
- public_key
19
- end
20
-
21
- factory :h_card, class: DiasporaFederation::Discovery::HCard do
22
- guid
23
- nickname "some_name"
24
- full_name "my name"
25
- first_name "my name"
26
- last_name nil
27
- url "http://localhost:3000/"
28
- public_key
29
- photo_large_url "/assets/user/default.png"
30
- photo_medium_url "/assets/user/default.png"
31
- photo_small_url "/assets/user/default.png"
32
- searchable true
33
- end
34
-
35
- factory :person_entity, class: DiasporaFederation::Entities::Person do
36
- guid
37
- diaspora_id
38
- url "http://localhost:3000/"
39
- exported_key { generate(:public_key) }
40
- profile {
41
- FactoryGirl.build(:profile_entity, diaspora_id: diaspora_id)
42
- }
43
- end
44
-
45
- factory :profile_entity, class: DiasporaFederation::Entities::Profile do
46
- diaspora_id
47
- first_name "my name"
48
- last_name nil
49
- image_url "/assets/user/default.png"
50
- image_url_medium "/assets/user/default.png"
51
- image_url_small "/assets/user/default.png"
52
- birthday "1988-07-15"
53
- gender "Male"
54
- bio "some text about me"
55
- location "github"
56
- searchable true
57
- nsfw false
58
- tag_string "#i #love #tags"
59
- end
60
-
61
- factory :location_entity, class: DiasporaFederation::Entities::Location do
62
- address "Vienna, Austria"
63
- lat 48.208174.to_s
64
- lng 16.373819.to_s
65
- end
66
-
67
- factory :photo_entity, class: DiasporaFederation::Entities::Photo do
68
- guid
69
- diaspora_id
70
- public(true)
71
- created_at { Time.zone.now }
72
- remote_photo_path "https://diaspora.example.tld/uploads/images/"
73
- remote_photo_name "f2a41e9d2db4d9a199c8.jpg"
74
- text "what you see here..."
75
- status_message_guid { generate(:guid) }
76
- height 480
77
- width 800
78
- end
79
-
80
- factory :relayable_entity, class: DiasporaFederation::Entities::Relayable do
81
- parent_guid { generate(:guid) }
82
- end
83
-
84
- factory :participation_entity, class: DiasporaFederation::Entities::Participation, parent: :relayable_entity do
85
- guid
86
- target_type "Post"
87
- diaspora_id
88
- end
89
-
90
- factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do
91
- raw_message "i am a very interesting status update"
92
- guid
93
- diaspora_id
94
- public(true)
95
- created_at { Time.zone.now }
96
- end
97
-
98
- factory :request_entity, class: DiasporaFederation::Entities::Request do
99
- sender_id { generate(:diaspora_id) }
100
- recipient_id { generate(:diaspora_id) }
101
- end
102
-
103
- factory :comment_entity, class: DiasporaFederation::Entities::Comment, parent: :relayable_entity do
104
- guid
105
- text "this is a very informative comment"
106
- diaspora_id
107
- end
108
-
109
- factory :like_entity, class: DiasporaFederation::Entities::Like, parent: :relayable_entity do
110
- positive true
111
- guid
112
- target_type "Post"
113
- diaspora_id
114
- end
115
-
116
- factory :account_deletion_entity, class: DiasporaFederation::Entities::AccountDeletion do
117
- diaspora_id
118
- end
119
-
120
- factory :conversation_entity, class: DiasporaFederation::Entities::Conversation do
121
- guid
122
- subject "this is a very informative subject"
123
- created_at { DateTime.now.utc }
124
- messages []
125
- diaspora_id
126
- participant_ids { 3.times.map { generate(:diaspora_id) }.join(";") }
127
- end
128
-
129
- factory :message_entity, class: DiasporaFederation::Entities::Message, parent: :relayable_entity do
130
- guid
131
- text "this is a very informative text"
132
- created_at { DateTime.now.utc }
133
- diaspora_id
134
- conversation_guid { generate(:guid) }
135
- end
136
-
137
- factory :relayable_retraction_entity, class: DiasporaFederation::Entities::RelayableRetraction do
138
- target_guid { generate(:guid) }
139
- target_type "Comment"
140
- diaspora_id
141
- end
142
-
143
- factory :reshare_entity, class: DiasporaFederation::Entities::Reshare do
144
- root_diaspora_id { generate(:diaspora_id) }
145
- root_guid { generate(:guid) }
146
- guid
147
- diaspora_id
148
- public(true)
149
- created_at { DateTime.now.utc }
150
- provider_display_name { "the testsuite" }
151
- end
152
-
153
- factory :retraction_entity, class: DiasporaFederation::Entities::Retraction do
154
- target_guid { generate(:guid) }
155
- diaspora_id
156
- target_type "Post"
157
- end
158
-
159
- factory :signed_retraction_entity, class: DiasporaFederation::Entities::SignedRetraction do
160
- target_guid { generate(:guid) }
161
- target_type "Post"
162
- diaspora_id
163
- end
164
-
165
- factory :poll_answer_entity, class: DiasporaFederation::Entities::PollAnswer do
166
- guid
167
- answer { "Obama is a bicycle" }
168
- end
169
-
170
- factory :poll_entity, class: DiasporaFederation::Entities::Poll do
171
- guid
172
- question { "Select an answer" }
173
- poll_answers { 3.times.map { FactoryGirl.build(:poll_answer_entity) } }
174
- end
175
-
176
- factory :poll_participation_entity,
177
- class: DiasporaFederation::Entities::PollParticipation,
178
- parent: :relayable_entity do
179
- guid
180
- diaspora_id
181
- poll_answer_guid { generate(:guid) }
4
+ module DiasporaFederation
5
+ module Test
6
+ module Factories
7
+ def self.federation_factories
8
+ FactoryGirl.define do
9
+ initialize_with { new(attributes) }
10
+ sequence(:guid) { UUID.generate :compact }
11
+ sequence(:diaspora_id) {|n| "person-#{n}-#{SecureRandom.hex(3)}@localhost:3000" }
12
+ sequence(:public_key) { OpenSSL::PKey::RSA.generate(1024).public_key.export }
13
+
14
+ factory :webfinger, class: DiasporaFederation::Discovery::WebFinger do
15
+ guid
16
+ acct_uri { "acct:#{generate(:diaspora_id)}" }
17
+ alias_url "http://localhost:3000/people/0123456789abcdef"
18
+ hcard_url "http://localhost:3000/hcard/users/user"
19
+ seed_url "http://localhost:3000/"
20
+ profile_url "http://localhost:3000/u/user"
21
+ atom_url "http://localhost:3000/public/user.atom"
22
+ salmon_url "http://localhost:3000/receive/users/0123456789abcdef"
23
+ public_key
24
+ subscribe_url "http://localhost:3000/people?q={uri}"
25
+ end
26
+
27
+ factory :h_card, class: DiasporaFederation::Discovery::HCard do
28
+ guid
29
+ nickname "some_name"
30
+ full_name "my name"
31
+ first_name "my name"
32
+ last_name nil
33
+ url "http://localhost:3000/"
34
+ public_key
35
+ photo_large_url "/assets/user/default.png"
36
+ photo_medium_url "/assets/user/default.png"
37
+ photo_small_url "/assets/user/default.png"
38
+ searchable true
39
+ end
40
+
41
+ factory :person_entity, class: DiasporaFederation::Entities::Person do
42
+ guid
43
+ diaspora_id
44
+ url "http://localhost:3000/"
45
+ exported_key { generate(:public_key) }
46
+ profile {
47
+ FactoryGirl.build(:profile_entity, diaspora_id: diaspora_id)
48
+ }
49
+ end
50
+
51
+ factory :profile_entity, class: DiasporaFederation::Entities::Profile do
52
+ diaspora_id
53
+ first_name "my name"
54
+ last_name nil
55
+ image_url "/assets/user/default.png"
56
+ image_url_medium "/assets/user/default.png"
57
+ image_url_small "/assets/user/default.png"
58
+ birthday "1988-07-15"
59
+ gender "Male"
60
+ bio "some text about me"
61
+ location "github"
62
+ searchable true
63
+ nsfw false
64
+ tag_string "#i #love #tags"
65
+ end
66
+
67
+ factory :location_entity, class: DiasporaFederation::Entities::Location do
68
+ address "Vienna, Austria"
69
+ lat 48.208174.to_s
70
+ lng 16.373819.to_s
71
+ end
72
+
73
+ factory :photo_entity, class: DiasporaFederation::Entities::Photo do
74
+ guid
75
+ diaspora_id
76
+ public(true)
77
+ created_at { Time.zone.now }
78
+ remote_photo_path "https://diaspora.example.tld/uploads/images/"
79
+ remote_photo_name "f2a41e9d2db4d9a199c8.jpg"
80
+ text "what you see here..."
81
+ status_message_guid { generate(:guid) }
82
+ height 480
83
+ width 800
84
+ end
85
+
86
+ factory :relayable_entity, class: DiasporaFederation::Entities::Relayable do
87
+ parent_guid { generate(:guid) }
88
+ end
89
+
90
+ factory :participation_entity,
91
+ class: DiasporaFederation::Entities::Participation, parent: :relayable_entity do
92
+ guid
93
+ target_type "Post"
94
+ diaspora_id
95
+ end
96
+
97
+ factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do
98
+ raw_message "i am a very interesting status update"
99
+ guid
100
+ diaspora_id
101
+ public(true)
102
+ created_at { Time.zone.now }
103
+ end
104
+
105
+ factory :request_entity, class: DiasporaFederation::Entities::Request do
106
+ sender_id { generate(:diaspora_id) }
107
+ recipient_id { generate(:diaspora_id) }
108
+ end
109
+
110
+ factory :comment_entity, class: DiasporaFederation::Entities::Comment, parent: :relayable_entity do
111
+ guid
112
+ text "this is a very informative comment"
113
+ diaspora_id
114
+ end
115
+
116
+ factory :like_entity, class: DiasporaFederation::Entities::Like, parent: :relayable_entity do
117
+ positive true
118
+ guid
119
+ target_type "Post"
120
+ diaspora_id
121
+ end
122
+
123
+ factory :account_deletion_entity, class: DiasporaFederation::Entities::AccountDeletion do
124
+ diaspora_id
125
+ end
126
+
127
+ factory :conversation_entity, class: DiasporaFederation::Entities::Conversation do
128
+ guid
129
+ subject "this is a very informative subject"
130
+ created_at { DateTime.now.utc }
131
+ messages []
132
+ diaspora_id
133
+ participant_ids { 3.times.map { generate(:diaspora_id) }.join(";") }
134
+ end
135
+
136
+ factory :message_entity, class: DiasporaFederation::Entities::Message, parent: :relayable_entity do
137
+ guid
138
+ text "this is a very informative text"
139
+ created_at { DateTime.now.utc }
140
+ diaspora_id
141
+ conversation_guid { generate(:guid) }
142
+ end
143
+
144
+ factory :relayable_retraction_entity, class: DiasporaFederation::Entities::RelayableRetraction do
145
+ target_guid { generate(:guid) }
146
+ target_type "Comment"
147
+ diaspora_id
148
+ end
149
+
150
+ factory :reshare_entity, class: DiasporaFederation::Entities::Reshare do
151
+ root_diaspora_id { generate(:diaspora_id) }
152
+ root_guid { generate(:guid) }
153
+ guid
154
+ diaspora_id
155
+ public(true)
156
+ created_at { DateTime.now.utc }
157
+ provider_display_name { "the testsuite" }
158
+ end
159
+
160
+ factory :retraction_entity, class: DiasporaFederation::Entities::Retraction do
161
+ target_guid { generate(:guid) }
162
+ diaspora_id
163
+ target_type "Post"
164
+ end
165
+
166
+ factory :signed_retraction_entity, class: DiasporaFederation::Entities::SignedRetraction do
167
+ target_guid { generate(:guid) }
168
+ target_type "Post"
169
+ diaspora_id
170
+ end
171
+
172
+ factory :poll_answer_entity, class: DiasporaFederation::Entities::PollAnswer do
173
+ guid
174
+ answer { "Obama is a bicycle" }
175
+ end
176
+
177
+ factory :poll_entity, class: DiasporaFederation::Entities::Poll do
178
+ guid
179
+ question { "Select an answer" }
180
+ poll_answers { 3.times.map { FactoryGirl.build(:poll_answer_entity) } }
181
+ end
182
+
183
+ factory :poll_participation_entity,
184
+ class: DiasporaFederation::Entities::PollParticipation, parent: :relayable_entity do
185
+ guid
186
+ diaspora_id
187
+ poll_answer_guid { generate(:guid) }
188
+ end
189
+ end
190
+ end
191
+ end
182
192
  end
183
193
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diaspora_federation-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Neff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2015-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diaspora_federation
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.9
19
+ version: 0.0.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.9
26
+ version: 0.0.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: factory_girl
29
29
  requirement: !ruby/object:Gem::Requirement