cloud-templates 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +29 -0
  3. data/.simplecov +6 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +201 -0
  6. data/NOTICE +13 -0
  7. data/README.md +124 -0
  8. data/Rakefile +27 -0
  9. data/cloud-templates.gemspec +27 -0
  10. data/examples/lib/user_directory/artifacts/catalogized.rb +11 -0
  11. data/examples/lib/user_directory/artifacts/group.rb +37 -0
  12. data/examples/lib/user_directory/artifacts/ided.rb +11 -0
  13. data/examples/lib/user_directory/artifacts/organization.rb +17 -0
  14. data/examples/lib/user_directory/artifacts/pathed.rb +22 -0
  15. data/examples/lib/user_directory/artifacts/person.rb +20 -0
  16. data/examples/lib/user_directory/artifacts/team.rb +31 -0
  17. data/examples/lib/user_directory/artifacts/unit.rb +24 -0
  18. data/examples/lib/user_directory/artifacts/user.rb +29 -0
  19. data/examples/lib/user_directory/render/etc/artifact_view.rb +15 -0
  20. data/examples/lib/user_directory/render/etc/composite_view.rb +26 -0
  21. data/examples/lib/user_directory/render/etc/group_view.rb +23 -0
  22. data/examples/lib/user_directory/render/etc/person_view.rb +19 -0
  23. data/examples/lib/user_directory/render/etc/registry.rb +33 -0
  24. data/examples/lib/user_directory/render/etc/user_view.rb +35 -0
  25. data/examples/lib/user_directory/render/etc.rb +3 -0
  26. data/examples/lib/user_directory/render/ldap/artifact_view.rb +27 -0
  27. data/examples/lib/user_directory/render/ldap/composite_view.rb +32 -0
  28. data/examples/lib/user_directory/render/ldap/group_view.rb +28 -0
  29. data/examples/lib/user_directory/render/ldap/organization_view.rb +26 -0
  30. data/examples/lib/user_directory/render/ldap/person_view.rb +39 -0
  31. data/examples/lib/user_directory/render/ldap/registry.rb +16 -0
  32. data/examples/lib/user_directory/render/ldap/unit_view.rb +26 -0
  33. data/examples/lib/user_directory/render/ldap/user_view.rb +39 -0
  34. data/examples/lib/user_directory/render/ldap.rb +3 -0
  35. data/examples/lib/user_directory/utils.rb +18 -0
  36. data/examples/lib/user_directory.rb +23 -0
  37. data/examples/lib_path.rb +2 -0
  38. data/examples/spec/spec_helper.rb +1 -0
  39. data/examples/spec/user_directory_spec.rb +568 -0
  40. data/lib/aws/templates/artifact.rb +140 -0
  41. data/lib/aws/templates/composite.rb +178 -0
  42. data/lib/aws/templates/exceptions.rb +221 -0
  43. data/lib/aws/templates/render/registry.rb +60 -0
  44. data/lib/aws/templates/render/utils/base_type_views.rb +131 -0
  45. data/lib/aws/templates/render/view.rb +127 -0
  46. data/lib/aws/templates/render.rb +72 -0
  47. data/lib/aws/templates/utils/artifact_storage.rb +141 -0
  48. data/lib/aws/templates/utils/contextualized/filters.rb +437 -0
  49. data/lib/aws/templates/utils/contextualized/hash.rb +13 -0
  50. data/lib/aws/templates/utils/contextualized/nil.rb +13 -0
  51. data/lib/aws/templates/utils/contextualized/proc.rb +13 -0
  52. data/lib/aws/templates/utils/contextualized.rb +113 -0
  53. data/lib/aws/templates/utils/default.rb +185 -0
  54. data/lib/aws/templates/utils/dependency/enumerable.rb +13 -0
  55. data/lib/aws/templates/utils/dependency/object.rb +46 -0
  56. data/lib/aws/templates/utils/dependency.rb +121 -0
  57. data/lib/aws/templates/utils/dependent.rb +28 -0
  58. data/lib/aws/templates/utils/inheritable.rb +52 -0
  59. data/lib/aws/templates/utils/late_bound.rb +89 -0
  60. data/lib/aws/templates/utils/memoized.rb +27 -0
  61. data/lib/aws/templates/utils/named.rb +19 -0
  62. data/lib/aws/templates/utils/options.rb +279 -0
  63. data/lib/aws/templates/utils/parametrized/constraints.rb +423 -0
  64. data/lib/aws/templates/utils/parametrized/getters.rb +293 -0
  65. data/lib/aws/templates/utils/parametrized/guarded.rb +32 -0
  66. data/lib/aws/templates/utils/parametrized/mapper.rb +73 -0
  67. data/lib/aws/templates/utils/parametrized/nested.rb +72 -0
  68. data/lib/aws/templates/utils/parametrized/transformations.rb +660 -0
  69. data/lib/aws/templates/utils/parametrized.rb +240 -0
  70. data/lib/aws/templates/utils.rb +219 -0
  71. data/lib/aws/templates.rb +16 -0
  72. data/spec/aws/templates/artifact_spec.rb +161 -0
  73. data/spec/aws/templates/composite_spec.rb +361 -0
  74. data/spec/aws/templates/render/utils/base_type_views_spec.rb +104 -0
  75. data/spec/aws/templates/render_spec.rb +62 -0
  76. data/spec/aws/templates/utils/as_named_spec.rb +31 -0
  77. data/spec/aws/templates/utils/contextualized/filters_spec.rb +108 -0
  78. data/spec/aws/templates/utils/contextualized_spec.rb +115 -0
  79. data/spec/aws/templates/utils/late_bound_spec.rb +52 -0
  80. data/spec/aws/templates/utils/options_spec.rb +67 -0
  81. data/spec/aws/templates/utils/parametrized/constraint_spec.rb +175 -0
  82. data/spec/aws/templates/utils/parametrized/getters_spec.rb +139 -0
  83. data/spec/aws/templates/utils/parametrized/transformation_spec.rb +314 -0
  84. data/spec/aws/templates/utils/parametrized_spec.rb +241 -0
  85. data/spec/spec_helper.rb +6 -0
  86. metadata +244 -0
@@ -0,0 +1,568 @@
1
+ require 'spec_helper'
2
+
3
+ require 'user_directory/artifacts/user'
4
+ require 'user_directory/artifacts/person'
5
+ require 'user_directory/artifacts/group'
6
+ require 'user_directory/artifacts/unit'
7
+ require 'user_directory/artifacts/team'
8
+ require 'user_directory/artifacts/organization'
9
+
10
+ require 'user_directory/render/etc'
11
+ require 'user_directory/render/ldap'
12
+
13
+ include UserDirectory
14
+
15
+ # rubocop:disable Metrics/BlockLength
16
+ describe UserDirectory do
17
+ let(:directory) do
18
+ Organization.new(name: 'example.com', root: Object.new) do
19
+ artifact(Unit, name: 'Business') do
20
+ artifact(
21
+ Team,
22
+ name: 'Sales',
23
+ group_id: 120,
24
+ manager: {
25
+ id: 1000,
26
+ login: 'wcorner',
27
+ given_name: 'Will',
28
+ middle_name: 'John',
29
+ last_name: 'Corner',
30
+ phone: '+13434345656'
31
+ },
32
+ subordinates: [
33
+ {
34
+ id: 1001,
35
+ login: 'ptsmth',
36
+ given_name: 'Peter',
37
+ middle_name: 'Will',
38
+ last_name: 'Smith',
39
+ phone: '+13434343434'
40
+ },
41
+ {
42
+ id: 1002,
43
+ login: 'joshrx',
44
+ given_name: 'Joshua',
45
+ last_name: 'Revoux',
46
+ phone: '+1343930434'
47
+ },
48
+ {
49
+ id: 1003,
50
+ login: 'helbuck',
51
+ given_name: 'Helmut',
52
+ middle_name: 'V',
53
+ last_name: 'Prust',
54
+ phone: '+13434347654'
55
+ }
56
+ ]
57
+ )
58
+
59
+ artifact(
60
+ Team,
61
+ name: 'Finances',
62
+ group_id: 110,
63
+ manager: {
64
+ id: 1010,
65
+ login: 'lcorner',
66
+ given_name: 'Lisa',
67
+ last_name: 'Corner',
68
+ phone: '+13434345656'
69
+ },
70
+ subordinates: [
71
+ {
72
+ id: 1011,
73
+ login: 'rickk',
74
+ given_name: 'Rick',
75
+ last_name: 'Kim',
76
+ phone: '+13434343876'
77
+ },
78
+ {
79
+ id: 1012,
80
+ login: 'jjohn',
81
+ given_name: 'Jay',
82
+ last_name: 'John',
83
+ phone: '+1343937667'
84
+ }
85
+ ]
86
+ )
87
+
88
+ artifact Group, name: 'business', id: 100, members: search(klass: User, recursive: true)
89
+ end
90
+
91
+ artifact(Unit, name: 'Engineering', shell: { path: '/bin/zsh' }) do
92
+ artifact(
93
+ Team,
94
+ name: 'Production',
95
+ group_id: 210,
96
+ manager: {
97
+ id: 2000,
98
+ login: 'wiknoz',
99
+ given_name: 'Wik',
100
+ last_name: 'Nozer',
101
+ phone: '+14564345656'
102
+ },
103
+ subordinates: [
104
+ {
105
+ id: 2001,
106
+ login: 'bmillen',
107
+ given_name: 'Robert',
108
+ last_name: 'Millen',
109
+ phone: '+14564343876'
110
+ },
111
+ {
112
+ id: 2002,
113
+ login: 'xxor',
114
+ given_name: 'Xavier',
115
+ last_name: 'Xordoux',
116
+ phone: '+14564343345'
117
+ }
118
+ ]
119
+ )
120
+
121
+ artifact(
122
+ Team,
123
+ name: 'Development',
124
+ group_id: 220,
125
+ manager: {
126
+ id: 2020,
127
+ login: 'reztrant',
128
+ given_name: 'Trant',
129
+ last_name: 'Reezner',
130
+ phone: '+14564809656'
131
+ },
132
+ subordinates: [
133
+ {
134
+ id: 2021,
135
+ login: 'dxrelk',
136
+ given_name: 'Dexter',
137
+ last_name: 'Relk',
138
+ phone: '+14564347646'
139
+ },
140
+ {
141
+ id: 2022,
142
+ login: 'mi5',
143
+ given_name: 'Michael',
144
+ last_name: 'Five',
145
+ phone: '+14564876345'
146
+ },
147
+ {
148
+ id: 2023,
149
+ login: 'uran',
150
+ given_name: 'Ulrich',
151
+ last_name: 'Randel',
152
+ phone: '+10984876345'
153
+ }
154
+ ]
155
+ )
156
+
157
+ artifact(
158
+ Team,
159
+ name: 'QA',
160
+ group_id: 230,
161
+ manager: {
162
+ id: 2030,
163
+ login: 'qwerty',
164
+ given_name: 'Q',
165
+ last_name: 'Werty',
166
+ phone: '+14564809656'
167
+ },
168
+ subordinates: [
169
+ {
170
+ id: 2031,
171
+ login: 'rrich',
172
+ given_name: 'Rick',
173
+ last_name: 'Richards',
174
+ phone: '+14565677646'
175
+ },
176
+ {
177
+ id: 2032,
178
+ login: 'jojo',
179
+ given_name: 'John',
180
+ last_name: 'Joque',
181
+ phone: '+14568476345'
182
+ },
183
+ {
184
+ id: 2033,
185
+ login: 'predate',
186
+ given_name: 'Patrick',
187
+ last_name: 'Redate',
188
+ phone: '+10988476345'
189
+ }
190
+ ]
191
+ )
192
+
193
+ artifact Group, name: 'engineering', id: 200, members: search(klass: User, recursive: true)
194
+ end
195
+
196
+ artifact Group, name: 'managers', id: 300, members: search(label: 'manager', recursive: true)
197
+ end
198
+ end
199
+
200
+ describe 'etc render' do
201
+ let(:rendered) { Render::Etc.view_for(directory).to_rendered }
202
+
203
+ let(:expected) do
204
+ UserDirectory::Render::Etc::Diff.new(
205
+ [
206
+ 'wcorner:x:1000:120:Will Corner (wcorner),,+13434345656:/home/wcorner:/bin/sh',
207
+ 'ptsmth:x:1001:120:Peter Smith (ptsmth),,+13434343434:/home/ptsmth:/bin/sh',
208
+ 'joshrx:x:1002:120:Joshua Revoux (joshrx),,+1343930434:/home/joshrx:/bin/sh',
209
+ 'helbuck:x:1003:120:Helmut Prust (helbuck),,+13434347654:/home/helbuck:/bin/sh',
210
+ 'lcorner:x:1010:110:Lisa Corner (lcorner),,+13434345656:/home/lcorner:/bin/sh',
211
+ 'rickk:x:1011:110:Rick Kim (rickk),,+13434343876:/home/rickk:/bin/sh',
212
+ 'jjohn:x:1012:110:Jay John (jjohn),,+1343937667:/home/jjohn:/bin/sh',
213
+ 'wiknoz:x:2000:210:Wik Nozer (wiknoz),,+14564345656:/home/wiknoz:/bin/zsh',
214
+ 'bmillen:x:2001:210:Robert Millen (bmillen),,+14564343876:/home/bmillen:/bin/zsh',
215
+ 'xxor:x:2002:210:Xavier Xordoux (xxor),,+14564343345:/home/xxor:/bin/zsh',
216
+ 'reztrant:x:2020:220:Trant Reezner (reztrant),,+14564809656:/home/reztrant:/bin/zsh',
217
+ 'dxrelk:x:2021:220:Dexter Relk (dxrelk),,+14564347646:/home/dxrelk:/bin/zsh',
218
+ 'mi5:x:2022:220:Michael Five (mi5),,+14564876345:/home/mi5:/bin/zsh',
219
+ 'uran:x:2023:220:Ulrich Randel (uran),,+10984876345:/home/uran:/bin/zsh',
220
+ 'qwerty:x:2030:230:Q Werty (qwerty),,+14564809656:/home/qwerty:/bin/zsh',
221
+ 'rrich:x:2031:230:Rick Richards (rrich),,+14565677646:/home/rrich:/bin/zsh',
222
+ 'jojo:x:2032:230:John Joque (jojo),,+14568476345:/home/jojo:/bin/zsh',
223
+ 'predate:x:2033:230:Patrick Redate (predate),,+10988476345:/home/predate:/bin/zsh'
224
+ ], [
225
+ 'sales:x:120:ptsmth,joshrx,helbuck,wcorner',
226
+ 'finances:x:110:rickk,jjohn,lcorner',
227
+ 'business:x:100:wcorner,ptsmth,joshrx,helbuck,lcorner,rickk,jjohn',
228
+ 'production:x:210:bmillen,xxor,wiknoz',
229
+ 'development:x:220:dxrelk,mi5,uran,reztrant',
230
+ 'qa:x:230:rrich,jojo,predate,qwerty',
231
+ 'engineering:x:200:wiknoz,bmillen,xxor,reztrant,dxrelk,mi5,' \
232
+ 'uran,qwerty,rrich,jojo,predate',
233
+ 'managers:x:300:wcorner,lcorner,wiknoz,reztrant,qwerty'
234
+ ]
235
+ )
236
+ end
237
+
238
+ it 'returns expected etc format with group and passwd section' do
239
+ expect(rendered).to be == expected
240
+ end
241
+ end
242
+
243
+ describe 'ldap render' do
244
+ let(:rendered) { Render::LDAP.view_for(directory).to_rendered }
245
+
246
+ let(:expected) do
247
+ [
248
+ {
249
+ dn: 'o=example.com',
250
+ objectClass: %w[top organization],
251
+ o: 'example.com'
252
+ }, {
253
+ dn: 'ou=Business,o=example.com',
254
+ objectClass: %w[top organizationalUnit],
255
+ ou: 'Business'
256
+ }, {
257
+ dn: 'ou=Sales,ou=Business,o=example.com',
258
+ objectClass: %w[top organizationalUnit],
259
+ ou: 'Sales'
260
+ }, {
261
+ dn: 'cn=sales,ou=System,o=example.com',
262
+ objectClass: %w[top posixGroup],
263
+ cn: 'sales',
264
+ gidNumber: 120,
265
+ memberUid: %w[ptsmth joshrx helbuck wcorner]
266
+ }, {
267
+ dn: 'cn=Will Corner (wcorner),ou=Sales,ou=Business,o=example.com',
268
+ objectClass: %w[top posixAccount inetOrgPerson person],
269
+ cn: 'Will Corner (wcorner)',
270
+ uid: 'wcorner',
271
+ uidNumber: 1000,
272
+ gidNumber: 120,
273
+ homeDirectory: '/home/wcorner',
274
+ loginShell: '/bin/sh',
275
+ gecos: 'Will Corner (wcorner),,+13434345656',
276
+ givenName: 'Will',
277
+ sn: 'Corner'
278
+ }, {
279
+ dn: 'cn=Peter Smith (ptsmth),ou=Sales,ou=Business,o=example.com',
280
+ objectClass: %w[top posixAccount inetOrgPerson person],
281
+ cn: 'Peter Smith (ptsmth)',
282
+ uid: 'ptsmth',
283
+ uidNumber: 1001,
284
+ gidNumber: 120,
285
+ homeDirectory: '/home/ptsmth',
286
+ loginShell: '/bin/sh',
287
+ gecos: 'Peter Smith (ptsmth),,+13434343434',
288
+ givenName: 'Peter',
289
+ sn: 'Smith',
290
+ manager: 'cn=Will Corner (wcorner),ou=Sales,ou=Business,o=example.com'
291
+ }, {
292
+ dn: 'cn=Joshua Revoux (joshrx),ou=Sales,ou=Business,o=example.com',
293
+ objectClass: %w[top posixAccount inetOrgPerson person],
294
+ cn: 'Joshua Revoux (joshrx)',
295
+ uid: 'joshrx',
296
+ uidNumber: 1002,
297
+ gidNumber: 120,
298
+ homeDirectory: '/home/joshrx',
299
+ loginShell: '/bin/sh',
300
+ gecos: 'Joshua Revoux (joshrx),,+1343930434',
301
+ givenName: 'Joshua',
302
+ sn: 'Revoux',
303
+ manager: 'cn=Will Corner (wcorner),ou=Sales,ou=Business,o=example.com'
304
+ }, {
305
+ dn: 'cn=Helmut Prust (helbuck),ou=Sales,ou=Business,o=example.com',
306
+ objectClass: %w[top posixAccount inetOrgPerson person],
307
+ cn: 'Helmut Prust (helbuck)',
308
+ uid: 'helbuck',
309
+ uidNumber: 1003,
310
+ gidNumber: 120,
311
+ homeDirectory: '/home/helbuck',
312
+ loginShell: '/bin/sh',
313
+ gecos: 'Helmut Prust (helbuck),,+13434347654',
314
+ givenName: 'Helmut',
315
+ sn: 'Prust',
316
+ manager: 'cn=Will Corner (wcorner),ou=Sales,ou=Business,o=example.com'
317
+ }, {
318
+ dn: 'ou=Finances,ou=Business,o=example.com',
319
+ objectClass: %w[top organizationalUnit],
320
+ ou: 'Finances'
321
+ }, {
322
+ dn: 'cn=finances,ou=System,o=example.com',
323
+ objectClass: %w[top posixGroup],
324
+ cn: 'finances',
325
+ gidNumber: 110,
326
+ memberUid: %w[rickk jjohn lcorner]
327
+ }, {
328
+ dn: 'cn=Lisa Corner (lcorner),ou=Finances,ou=Business,o=example.com',
329
+ objectClass: %w[top posixAccount inetOrgPerson person],
330
+ cn: 'Lisa Corner (lcorner)',
331
+ uid: 'lcorner',
332
+ uidNumber: 1010,
333
+ gidNumber: 110,
334
+ homeDirectory: '/home/lcorner',
335
+ loginShell: '/bin/sh',
336
+ gecos: 'Lisa Corner (lcorner),,+13434345656',
337
+ givenName: 'Lisa',
338
+ sn: 'Corner'
339
+ }, {
340
+ dn: 'cn=Rick Kim (rickk),ou=Finances,ou=Business,o=example.com',
341
+ objectClass: %w[top posixAccount inetOrgPerson person],
342
+ cn: 'Rick Kim (rickk)',
343
+ uid: 'rickk',
344
+ uidNumber: 1011,
345
+ gidNumber: 110,
346
+ homeDirectory: '/home/rickk',
347
+ loginShell: '/bin/sh',
348
+ gecos: 'Rick Kim (rickk),,+13434343876',
349
+ givenName: 'Rick',
350
+ sn: 'Kim',
351
+ manager: 'cn=Lisa Corner (lcorner),ou=Finances,ou=Business,o=example.com'
352
+ }, {
353
+ dn: 'cn=Jay John (jjohn),ou=Finances,ou=Business,o=example.com',
354
+ objectClass: %w[top posixAccount inetOrgPerson person],
355
+ cn: 'Jay John (jjohn)',
356
+ uid: 'jjohn',
357
+ uidNumber: 1012,
358
+ gidNumber: 110,
359
+ homeDirectory: '/home/jjohn',
360
+ loginShell: '/bin/sh',
361
+ gecos: 'Jay John (jjohn),,+1343937667',
362
+ givenName: 'Jay',
363
+ sn: 'John',
364
+ manager: 'cn=Lisa Corner (lcorner),ou=Finances,ou=Business,o=example.com'
365
+ }, {
366
+ dn: 'cn=business,ou=System,o=example.com',
367
+ objectClass: %w[top posixGroup],
368
+ cn: 'business',
369
+ gidNumber: 100,
370
+ memberUid: %w[wcorner ptsmth joshrx helbuck lcorner rickk jjohn]
371
+ }, {
372
+ dn: 'ou=Engineering,o=example.com',
373
+ objectClass: %w[top organizationalUnit],
374
+ ou: 'Engineering'
375
+ }, {
376
+ dn: 'ou=Production,ou=Engineering,o=example.com',
377
+ objectClass: %w[top organizationalUnit],
378
+ ou: 'Production'
379
+ }, {
380
+ dn: 'cn=production,ou=System,o=example.com',
381
+ objectClass: %w[top posixGroup],
382
+ cn: 'production',
383
+ gidNumber: 210,
384
+ memberUid: %w[bmillen xxor wiknoz]
385
+ }, {
386
+ dn: 'cn=Wik Nozer (wiknoz),ou=Production,ou=Engineering,o=example.com',
387
+ objectClass: %w[top posixAccount inetOrgPerson person],
388
+ cn: 'Wik Nozer (wiknoz)',
389
+ uid: 'wiknoz',
390
+ uidNumber: 2000,
391
+ gidNumber: 210,
392
+ homeDirectory: '/home/wiknoz',
393
+ loginShell: '/bin/zsh',
394
+ gecos: 'Wik Nozer (wiknoz),,+14564345656',
395
+ givenName: 'Wik',
396
+ sn: 'Nozer'
397
+ }, {
398
+ dn: 'cn=Robert Millen (bmillen),ou=Production,ou=Engineering,o=example.com',
399
+ objectClass: %w[top posixAccount inetOrgPerson person],
400
+ cn: 'Robert Millen (bmillen)',
401
+ uid: 'bmillen',
402
+ uidNumber: 2001,
403
+ gidNumber: 210,
404
+ homeDirectory: '/home/bmillen',
405
+ loginShell: '/bin/zsh',
406
+ gecos: 'Robert Millen (bmillen),,+14564343876',
407
+ givenName: 'Robert',
408
+ sn: 'Millen',
409
+ manager: 'cn=Wik Nozer (wiknoz),ou=Production,ou=Engineering,o=example.com'
410
+ }, {
411
+ dn: 'cn=Xavier Xordoux (xxor),ou=Production,ou=Engineering,o=example.com',
412
+ objectClass: %w[top posixAccount inetOrgPerson person],
413
+ cn: 'Xavier Xordoux (xxor)',
414
+ uid: 'xxor',
415
+ uidNumber: 2002,
416
+ gidNumber: 210,
417
+ homeDirectory: '/home/xxor',
418
+ loginShell: '/bin/zsh',
419
+ gecos: 'Xavier Xordoux (xxor),,+14564343345',
420
+ givenName: 'Xavier',
421
+ sn: 'Xordoux',
422
+ manager: 'cn=Wik Nozer (wiknoz),ou=Production,ou=Engineering,o=example.com'
423
+ }, {
424
+ dn: 'ou=Development,ou=Engineering,o=example.com',
425
+ objectClass: %w[top organizationalUnit],
426
+ ou: 'Development'
427
+ }, {
428
+ dn: 'cn=development,ou=System,o=example.com',
429
+ objectClass: %w[top posixGroup],
430
+ cn: 'development',
431
+ gidNumber: 220,
432
+ memberUid: %w[dxrelk mi5 uran reztrant]
433
+ }, {
434
+ dn: 'cn=Trant Reezner (reztrant),ou=Development,ou=Engineering,o=example.com',
435
+ objectClass: %w[top posixAccount inetOrgPerson person],
436
+ cn: 'Trant Reezner (reztrant)',
437
+ uid: 'reztrant',
438
+ uidNumber: 2020,
439
+ gidNumber: 220,
440
+ homeDirectory: '/home/reztrant',
441
+ loginShell: '/bin/zsh',
442
+ gecos: 'Trant Reezner (reztrant),,+14564809656',
443
+ givenName: 'Trant',
444
+ sn: 'Reezner'
445
+ }, {
446
+ dn: 'cn=Dexter Relk (dxrelk),ou=Development,ou=Engineering,o=example.com',
447
+ objectClass: %w[top posixAccount inetOrgPerson person],
448
+ cn: 'Dexter Relk (dxrelk)',
449
+ uid: 'dxrelk',
450
+ uidNumber: 2021,
451
+ gidNumber: 220,
452
+ homeDirectory: '/home/dxrelk',
453
+ loginShell: '/bin/zsh',
454
+ gecos: 'Dexter Relk (dxrelk),,+14564347646',
455
+ givenName: 'Dexter',
456
+ sn: 'Relk',
457
+ manager: 'cn=Trant Reezner (reztrant),ou=Development,ou=Engineering,o=example.com'
458
+ }, {
459
+ dn: 'cn=Michael Five (mi5),ou=Development,ou=Engineering,o=example.com',
460
+ objectClass: %w[top posixAccount inetOrgPerson person],
461
+ cn: 'Michael Five (mi5)',
462
+ uid: 'mi5',
463
+ uidNumber: 2022,
464
+ gidNumber: 220,
465
+ homeDirectory: '/home/mi5',
466
+ loginShell: '/bin/zsh',
467
+ gecos: 'Michael Five (mi5),,+14564876345',
468
+ givenName: 'Michael',
469
+ sn: 'Five',
470
+ manager: 'cn=Trant Reezner (reztrant),ou=Development,ou=Engineering,o=example.com'
471
+ }, {
472
+ dn: 'cn=Ulrich Randel (uran),ou=Development,ou=Engineering,o=example.com',
473
+ objectClass: %w[top posixAccount inetOrgPerson person],
474
+ cn: 'Ulrich Randel (uran)',
475
+ uid: 'uran',
476
+ uidNumber: 2023,
477
+ gidNumber: 220,
478
+ homeDirectory: '/home/uran',
479
+ loginShell: '/bin/zsh',
480
+ gecos: 'Ulrich Randel (uran),,+10984876345',
481
+ givenName: 'Ulrich',
482
+ sn: 'Randel',
483
+ manager: 'cn=Trant Reezner (reztrant),ou=Development,ou=Engineering,o=example.com'
484
+ }, {
485
+ dn: 'ou=QA,ou=Engineering,o=example.com',
486
+ objectClass: %w[top organizationalUnit],
487
+ ou: 'QA'
488
+ }, {
489
+ dn: 'cn=qa,ou=System,o=example.com',
490
+ objectClass: %w[top posixGroup],
491
+ cn: 'qa',
492
+ gidNumber: 230,
493
+ memberUid: %w[rrich jojo predate qwerty]
494
+ }, {
495
+ dn: 'cn=Q Werty (qwerty),ou=QA,ou=Engineering,o=example.com',
496
+ objectClass: %w[top posixAccount inetOrgPerson person],
497
+ cn: 'Q Werty (qwerty)',
498
+ uid: 'qwerty',
499
+ uidNumber: 2030,
500
+ gidNumber: 230,
501
+ homeDirectory: '/home/qwerty',
502
+ loginShell: '/bin/zsh',
503
+ gecos: 'Q Werty (qwerty),,+14564809656',
504
+ givenName: 'Q',
505
+ sn: 'Werty'
506
+ }, {
507
+ dn: 'cn=Rick Richards (rrich),ou=QA,ou=Engineering,o=example.com',
508
+ objectClass: %w[top posixAccount inetOrgPerson person],
509
+ cn: 'Rick Richards (rrich)',
510
+ uid: 'rrich',
511
+ uidNumber: 2031,
512
+ gidNumber: 230,
513
+ homeDirectory: '/home/rrich',
514
+ loginShell: '/bin/zsh',
515
+ gecos: 'Rick Richards (rrich),,+14565677646',
516
+ givenName: 'Rick',
517
+ sn: 'Richards',
518
+ manager: 'cn=Q Werty (qwerty),ou=QA,ou=Engineering,o=example.com'
519
+ }, {
520
+ dn: 'cn=John Joque (jojo),ou=QA,ou=Engineering,o=example.com',
521
+ objectClass: %w[top posixAccount inetOrgPerson person],
522
+ cn: 'John Joque (jojo)',
523
+ uid: 'jojo',
524
+ uidNumber: 2032,
525
+ gidNumber: 230,
526
+ homeDirectory: '/home/jojo',
527
+ loginShell: '/bin/zsh',
528
+ gecos: 'John Joque (jojo),,+14568476345',
529
+ givenName: 'John',
530
+ sn: 'Joque',
531
+ manager: 'cn=Q Werty (qwerty),ou=QA,ou=Engineering,o=example.com'
532
+ }, {
533
+ dn: 'cn=Patrick Redate (predate),ou=QA,ou=Engineering,o=example.com',
534
+ objectClass: %w[top posixAccount inetOrgPerson person],
535
+ cn: 'Patrick Redate (predate)',
536
+ uid: 'predate',
537
+ uidNumber: 2033,
538
+ gidNumber: 230,
539
+ homeDirectory: '/home/predate',
540
+ loginShell: '/bin/zsh',
541
+ gecos: 'Patrick Redate (predate),,+10988476345',
542
+ givenName: 'Patrick',
543
+ sn: 'Redate',
544
+ manager: 'cn=Q Werty (qwerty),ou=QA,ou=Engineering,o=example.com'
545
+ }, {
546
+ dn: 'cn=engineering,ou=System,o=example.com',
547
+ objectClass: %w[top posixGroup],
548
+ cn: 'engineering',
549
+ gidNumber: 200,
550
+ memberUid: %w[
551
+ wiknoz bmillen xxor reztrant dxrelk mi5 uran qwerty rrich
552
+ jojo predate
553
+ ]
554
+ }, {
555
+ dn: 'cn=managers,ou=System,o=example.com',
556
+ objectClass: %w[top posixGroup],
557
+ cn: 'managers',
558
+ gidNumber: 300,
559
+ memberUid: %w[wcorner lcorner wiknoz reztrant qwerty]
560
+ }
561
+ ]
562
+ end
563
+
564
+ it 'returns expected LDIF definition' do
565
+ expect(rendered).to be == expected
566
+ end
567
+ end
568
+ end