Browse Source

Test editorial model updated to use two different datasources

- defining a new datasource named dummy2 in both tests conf and install/conf.d
- adding two class using the new datasource in em_test.py
 - index : abtract class representing indexes (two fields, name & content)
 - indextheme : thematic index, inheriting from index but with one more field "theme"
Yann Weber 8 years ago
parent
commit
d6fbc5cfd1

+ 51
- 1
em_test.py View File

@@ -288,5 +288,55 @@ text.new_field( 'linked_persons',
288 288
                 group = editorial_person_group,
289 289
 )
290 290
 
291
+#####################
292
+# Index classes     # <--- Note :   using a different datasource for testing
293
+#####################               purpose
294
+
295
+index_group = em.new_group( 'index_group',
296
+                            display_name = 'Indexes',
297
+                            help_text = {
298
+                                'eng': 'EM class that represents indexes'},
299
+                            depends = (editorial_group,))
300
+
301
+index_abstract = em.new_class(
302
+    'indexAbs',
303
+    display_name = {'eng': 'Abstract Index'},
304
+    help_text = {'eng': 'Abstract class common to each Index classes'},
305
+    abstract = True,
306
+    group = index_group,
307
+    datasource = 'dummy2',
308
+    parents = em_object)
309
+
310
+index_name = index_abstract.new_field(
311
+    'name',
312
+    display_name = {
313
+        'eng': 'name',
314
+        'fre': 'nom'},
315
+    data_handler = 'varchar')
316
+
317
+index_value = index_abstract.new_field(
318
+    'value',
319
+    display_name = {
320
+        'eng': 'value',
321
+        'fre': 'valeur'},
322
+    data_handler = 'varchar')
323
+
324
+index_theme = em.new_class(
325
+    'indexTheme',
326
+    display_name = {
327
+        'eng': 'Thematic index',
328
+        'fre': 'Index thématique'},
329
+    group = index_group,
330
+    datasource = 'dummy2',
331
+    parents = index_abstract)
332
+
333
+index_theme_theme = index_abstract.new_field(
334
+    'theme',
335
+    display_name = {
336
+        'eng': 'theme'},
337
+    data_handler = 'varchar')
338
+
291 339
 #em.save('xmlfile', filename = 'examples/em_test.xml')
292
-em.save('picklefile', filename = 'examples/em_test.pickle')
340
+pickle_file = 'examples/em_test.pickle'
341
+em.save('picklefile', filename = pickle_file)
342
+print("Output written in %s" % pickle_file)

BIN
examples/em_test.pickle View File


+ 5
- 0
install/conf.d/datasources.ini View File

@@ -1,5 +1,10 @@
1 1
 [lodel2.datasources.default]
2 2
 identifier = dummy_datasource.example
3 3
 
4
+[lodel2.datasources.dummy2]
5
+identifier = dummy_datasource.dummy2
6
+
4 7
 [lodel2.datasource.dummy_datasource.example]
5 8
 dummy =
9
+[lodel2.datasource.dummy_datasource.dummy2]
10
+dummy =

BIN
tests/editorial_model.pickle View File


+ 2
- 0
tests/tests_conf.d/datasources.ini View File

@@ -1,5 +1,7 @@
1 1
 [lodel2.datasources.default]
2 2
 identifier = dummy_datasource.example
3
+[lodel2.datasources.dummy2]
4
+identifier = dummy_datasource.example
3 5
 
4 6
 [lodel2.datasource.dummy_datasource.example]
5 7
 dummy =

Loading…
Cancel
Save