diaspora_federation-test 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d26a01a508e1ce0d3e3df756d9d87ad97856ccb0
|
4
|
+
data.tar.gz: 88c63320bf19f4a44d7bea92801d1c61fb0d1d85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de4434e11f480bc8cd0fe2d4d76657d40e0576929722c342eaa4ee1c9334d69457e671432b0044c2337bc9edee6ee03dc09b03fc8b4cfd3e2db37e610d712bce
|
7
|
+
data.tar.gz: 4f5387543afc3be73557fc5ff657af619a7f4006a1cca002f4f157250d4082691ce26b9eb2c6af52bd8a4fd4af0faf56790fb5bcab8f9e8dea8948b808ed2dd3
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module DiasporaFederation
|
2
|
+
module Test
|
3
|
+
# Generator to instantiate entities
|
4
|
+
class EntityGenerator < Fabrication::Generator::Base
|
5
|
+
def self.supports?(klass)
|
6
|
+
klass.ancestors.include?(DiasporaFederation::Entity)
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_instance
|
10
|
+
self._instance = _klass.new(_attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_hash(attributes=[], _callbacks=[])
|
14
|
+
process_attributes(attributes)
|
15
|
+
_attributes.each_with_object({}) do |(name, value), hash|
|
16
|
+
hash[name.to_sym] = value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Fabrication.configure do |config|
|
22
|
+
config.generators << EntityGenerator
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,231 +1,208 @@
|
|
1
|
-
require "diaspora_federation"
|
2
|
-
require "factory_girl"
|
3
1
|
require "uuid"
|
2
|
+
require "securerandom"
|
3
|
+
require "diaspora_federation/test"
|
4
4
|
|
5
5
|
module DiasporaFederation
|
6
6
|
module Test
|
7
7
|
# Factories for federation entities
|
8
8
|
module Factories
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
guid
|
207
|
-
summary "Cool event"
|
208
|
-
description "You need to see this!"
|
209
|
-
start { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) - 1.hour }
|
210
|
-
add_attribute(:end) { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) + 1.hour }
|
211
|
-
all_day false
|
212
|
-
timezone "Europe/Berlin"
|
213
|
-
end
|
214
|
-
|
215
|
-
factory :event_participation_entity,
|
216
|
-
class: DiasporaFederation::Entities::EventParticipation, parent: :relayable_entity do
|
217
|
-
author { generate(:diaspora_id) }
|
218
|
-
guid
|
219
|
-
status "accepted"
|
220
|
-
end
|
221
|
-
|
222
|
-
factory :related_entity, class: DiasporaFederation::Entities::RelatedEntity do
|
223
|
-
author { generate(:diaspora_id) }
|
224
|
-
local true
|
225
|
-
public false
|
226
|
-
parent nil
|
227
|
-
end
|
228
|
-
end
|
9
|
+
Fabricate.sequence(:guid) { UUID.generate(:compact) }
|
10
|
+
Fabricate.sequence(:diaspora_id) {|n| "person-#{n}-#{SecureRandom.hex(3)}@localhost:3000" }
|
11
|
+
Fabricate.sequence(:public_key) { OpenSSL::PKey::RSA.generate(1024).public_key.export }
|
12
|
+
|
13
|
+
Fabricator(:webfinger, class_name: DiasporaFederation::Discovery::WebFinger) do
|
14
|
+
acct_uri { "acct:#{Fabricate.sequence(:diaspora_id)}" }
|
15
|
+
alias_url "http://localhost:3000/people/0123456789abcdef"
|
16
|
+
hcard_url "http://localhost:3000/hcard/users/user"
|
17
|
+
seed_url "http://localhost:3000/"
|
18
|
+
profile_url "http://localhost:3000/u/user"
|
19
|
+
atom_url "http://localhost:3000/public/user.atom"
|
20
|
+
salmon_url "http://localhost:3000/receive/users/0123456789abcdef"
|
21
|
+
subscribe_url "http://localhost:3000/people?q={uri}"
|
22
|
+
end
|
23
|
+
|
24
|
+
Fabricator(:h_card, class_name: DiasporaFederation::Discovery::HCard) do
|
25
|
+
guid { Fabricate.sequence(:guid) }
|
26
|
+
nickname "some_name"
|
27
|
+
full_name "my name"
|
28
|
+
first_name "my name"
|
29
|
+
last_name ""
|
30
|
+
url "http://localhost:3000/"
|
31
|
+
public_key { Fabricate.sequence(:public_key) }
|
32
|
+
photo_large_url "/assets/user/default.png"
|
33
|
+
photo_medium_url "/assets/user/default.png"
|
34
|
+
photo_small_url "/assets/user/default.png"
|
35
|
+
searchable true
|
36
|
+
end
|
37
|
+
|
38
|
+
Fabricator(:account_deletion_entity, class_name: DiasporaFederation::Entities::AccountDeletion) do
|
39
|
+
author { Fabricate.sequence(:diaspora_id) }
|
40
|
+
end
|
41
|
+
|
42
|
+
Fabricator(:account_migration_entity, class_name: DiasporaFederation::Entities::AccountMigration) do
|
43
|
+
author { Fabricate.sequence(:diaspora_id) }
|
44
|
+
profile { Fabricate(:profile_entity) }
|
45
|
+
end
|
46
|
+
|
47
|
+
Fabricator(:person_entity, class_name: DiasporaFederation::Entities::Person) do
|
48
|
+
guid { Fabricate.sequence(:guid) }
|
49
|
+
author { Fabricate.sequence(:diaspora_id) }
|
50
|
+
url "http://localhost:3000/"
|
51
|
+
exported_key { Fabricate.sequence(:public_key) }
|
52
|
+
profile {|attrs| Fabricate(:profile_entity, author: attrs[:author]) }
|
53
|
+
end
|
54
|
+
|
55
|
+
Fabricator(:profile_entity, class_name: DiasporaFederation::Entities::Profile) do
|
56
|
+
author { Fabricate.sequence(:diaspora_id) }
|
57
|
+
first_name "my name"
|
58
|
+
last_name ""
|
59
|
+
image_url "/assets/user/default.png"
|
60
|
+
image_url_medium "/assets/user/default.png"
|
61
|
+
image_url_small "/assets/user/default.png"
|
62
|
+
birthday "1988-07-15"
|
63
|
+
gender "Male"
|
64
|
+
bio "some text about me"
|
65
|
+
location "github"
|
66
|
+
searchable true
|
67
|
+
public false
|
68
|
+
nsfw false
|
69
|
+
tag_string "#i #love #tags"
|
70
|
+
end
|
71
|
+
|
72
|
+
Fabricator(:location_entity, class_name: DiasporaFederation::Entities::Location) do
|
73
|
+
address "Vienna, Austria"
|
74
|
+
lat 48.208174.to_s
|
75
|
+
lng 16.373819.to_s
|
76
|
+
end
|
77
|
+
|
78
|
+
Fabricator(:photo_entity, class_name: DiasporaFederation::Entities::Photo) do
|
79
|
+
guid { Fabricate.sequence(:guid) }
|
80
|
+
author { Fabricate.sequence(:diaspora_id) }
|
81
|
+
public true
|
82
|
+
created_at { Time.now.utc }
|
83
|
+
remote_photo_path "https://diaspora.example.tld/uploads/images/"
|
84
|
+
remote_photo_name "f2a41e9d2db4d9a199c8.jpg"
|
85
|
+
text "what you see here..."
|
86
|
+
status_message_guid { Fabricate.sequence(:guid) }
|
87
|
+
height 480
|
88
|
+
width 800
|
89
|
+
end
|
90
|
+
|
91
|
+
Fabricator(:relayable_entity, class_name: DiasporaFederation::Entities::Relayable) do
|
92
|
+
parent_guid { Fabricate.sequence(:guid) }
|
93
|
+
parent { Fabricate(:related_entity) }
|
94
|
+
end
|
95
|
+
|
96
|
+
Fabricator(:participation_entity, class_name: DiasporaFederation::Entities::Participation) do
|
97
|
+
author { Fabricate.sequence(:diaspora_id) }
|
98
|
+
guid { Fabricate.sequence(:guid) }
|
99
|
+
parent_guid { Fabricate.sequence(:guid) }
|
100
|
+
parent_type "Post"
|
101
|
+
end
|
102
|
+
|
103
|
+
Fabricator(:status_message_entity, class_name: DiasporaFederation::Entities::StatusMessage) do
|
104
|
+
text "i am a very interesting status update"
|
105
|
+
author { Fabricate.sequence(:diaspora_id) }
|
106
|
+
guid { Fabricate.sequence(:guid) }
|
107
|
+
public true
|
108
|
+
created_at { Time.now.utc }
|
109
|
+
end
|
110
|
+
|
111
|
+
Fabricator(:contact_entity, class_name: DiasporaFederation::Entities::Contact) do
|
112
|
+
author { Fabricate.sequence(:diaspora_id) }
|
113
|
+
recipient { Fabricate.sequence(:diaspora_id) }
|
114
|
+
following true
|
115
|
+
sharing true
|
116
|
+
end
|
117
|
+
|
118
|
+
Fabricator(:comment_entity, class_name: DiasporaFederation::Entities::Comment, from: :relayable_entity) do
|
119
|
+
author { Fabricate.sequence(:diaspora_id) }
|
120
|
+
guid { Fabricate.sequence(:guid) }
|
121
|
+
text "this is a very informative comment"
|
122
|
+
end
|
123
|
+
|
124
|
+
Fabricator(:like_entity, class_name: DiasporaFederation::Entities::Like, from: :relayable_entity) do
|
125
|
+
positive true
|
126
|
+
author { Fabricate.sequence(:diaspora_id) }
|
127
|
+
guid { Fabricate.sequence(:guid) }
|
128
|
+
parent_type "Post"
|
129
|
+
end
|
130
|
+
|
131
|
+
Fabricator(:conversation_entity, class_name: DiasporaFederation::Entities::Conversation) do
|
132
|
+
author { Fabricate.sequence(:diaspora_id) }
|
133
|
+
guid { Fabricate.sequence(:guid) }
|
134
|
+
subject "this is a very informative subject"
|
135
|
+
created_at { Time.now.utc }
|
136
|
+
messages []
|
137
|
+
participants { Array.new(3) { Fabricate.sequence(:diaspora_id) }.join(";") }
|
138
|
+
end
|
139
|
+
|
140
|
+
Fabricator(:message_entity, class_name: DiasporaFederation::Entities::Message) do
|
141
|
+
guid { Fabricate.sequence(:guid) }
|
142
|
+
author { Fabricate.sequence(:diaspora_id) }
|
143
|
+
text "this is a very informative text"
|
144
|
+
created_at { Time.now.utc }
|
145
|
+
conversation_guid { Fabricate.sequence(:guid) }
|
146
|
+
end
|
147
|
+
|
148
|
+
Fabricator(:reshare_entity, class_name: DiasporaFederation::Entities::Reshare) do
|
149
|
+
root_author { Fabricate.sequence(:diaspora_id) }
|
150
|
+
root_guid { Fabricate.sequence(:guid) }
|
151
|
+
guid { Fabricate.sequence(:guid) }
|
152
|
+
author { Fabricate.sequence(:diaspora_id) }
|
153
|
+
public true
|
154
|
+
created_at { Time.now.utc }
|
155
|
+
provider_display_name { "the testsuite" }
|
156
|
+
end
|
157
|
+
|
158
|
+
Fabricator(:retraction_entity, class_name: DiasporaFederation::Entities::Retraction) do
|
159
|
+
author { Fabricate.sequence(:diaspora_id) }
|
160
|
+
target_guid { Fabricate.sequence(:guid) }
|
161
|
+
target_type "Post"
|
162
|
+
target {|attrs| Fabricate(:related_entity, author: attrs[:author]) }
|
163
|
+
end
|
164
|
+
|
165
|
+
Fabricator(:poll_answer_entity, class_name: DiasporaFederation::Entities::PollAnswer) do
|
166
|
+
guid { Fabricate.sequence(:guid) }
|
167
|
+
answer { "Obama is a bicycle" }
|
168
|
+
end
|
169
|
+
|
170
|
+
Fabricator(:poll_entity, class_name: DiasporaFederation::Entities::Poll) do
|
171
|
+
guid { Fabricate.sequence(:guid) }
|
172
|
+
question { "Select an answer" }
|
173
|
+
poll_answers { Array.new(3) { Fabricate(:poll_answer_entity) } }
|
174
|
+
end
|
175
|
+
|
176
|
+
Fabricator(:poll_participation_entity,
|
177
|
+
class_name: DiasporaFederation::Entities::PollParticipation, from: :relayable_entity) do
|
178
|
+
author { Fabricate.sequence(:diaspora_id) }
|
179
|
+
guid { Fabricate.sequence(:guid) }
|
180
|
+
poll_answer_guid { Fabricate.sequence(:guid) }
|
181
|
+
end
|
182
|
+
|
183
|
+
Fabricator(:event_entity, class_name: DiasporaFederation::Entities::Event) do |f|
|
184
|
+
author { Fabricate.sequence(:diaspora_id) }
|
185
|
+
guid { Fabricate.sequence(:guid) }
|
186
|
+
summary "Cool event"
|
187
|
+
description "You need to see this!"
|
188
|
+
start { change_time(Time.now.utc, min: 0) - 3600 }
|
189
|
+
f.end { change_time(Time.now.utc, min: 0) + 3600 }
|
190
|
+
all_day false
|
191
|
+
timezone "Europe/Berlin"
|
192
|
+
end
|
193
|
+
|
194
|
+
Fabricator(:event_participation_entity,
|
195
|
+
class_name: DiasporaFederation::Entities::EventParticipation, from: :relayable_entity) do
|
196
|
+
author { Fabricate.sequence(:diaspora_id) }
|
197
|
+
guid { Fabricate.sequence(:guid) }
|
198
|
+
status "accepted"
|
199
|
+
end
|
200
|
+
|
201
|
+
Fabricator(:related_entity, class_name: DiasporaFederation::Entities::RelatedEntity) do
|
202
|
+
author { Fabricate.sequence(:diaspora_id) }
|
203
|
+
local true
|
204
|
+
public false
|
205
|
+
parent nil
|
229
206
|
end
|
230
207
|
end
|
231
208
|
end
|
@@ -1,4 +1,7 @@
|
|
1
|
-
require "
|
1
|
+
require "fabrication"
|
2
|
+
|
3
|
+
require "diaspora_federation"
|
4
|
+
require "diaspora_federation/test/entity_generator"
|
2
5
|
|
3
6
|
module DiasporaFederation
|
4
7
|
# This module encapsulates helper functions maybe wanted by a testsuite of a diaspora_federation gem user application.
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Neff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diaspora_federation
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.2.0
|
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.
|
26
|
+
version: 0.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: fabrication
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.16.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.16.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: uuid
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,6 +61,7 @@ extensions: []
|
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
63
|
- lib/diaspora_federation/test.rb
|
64
|
+
- lib/diaspora_federation/test/entity_generator.rb
|
64
65
|
- lib/diaspora_federation/test/factories.rb
|
65
66
|
homepage: https://github.com/diaspora/diaspora_federation
|
66
67
|
licenses:
|