apidae 1.2.16 → 1.2.20
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 +5 -5
- data/app/models/apidae/apidae_data_parser.rb +9 -3
- data/app/models/apidae/file_import.rb +11 -5
- data/app/models/apidae/obj.rb +1 -1
- data/lib/apidae/version.rb +1 -1
- data/test/data/shared_selections.json +15 -0
- data/test/dummy/db/schema.rb +3 -1
- data/test/dummy/log/development.log +330 -0
- data/test/dummy/log/test.log +6062 -0
- data/test/models/apidae/file_import_test.rb +23 -0
- metadata +5 -3
@@ -166,6 +166,29 @@ module Apidae
|
|
166
166
|
assert_equal 0, Selection.count
|
167
167
|
end
|
168
168
|
|
169
|
+
test "object deletion cancelled if used by another project" do
|
170
|
+
proj = Project.create(apidae_id: 123)
|
171
|
+
other_proj = Project.create(apidae_id: 456)
|
172
|
+
sel = Selection.create(apidae_id: 49063, apidae_project_id: proj.id, label: 'Sélection 2', reference: 'selection-2')
|
173
|
+
other_sel = Selection.create(apidae_id: 49999, apidae_project_id: other_proj.id, label: 'Sélection 99', reference: 'selection-99')
|
174
|
+
sel.objects << Obj.create(apidae_id: 503, title: 'Société des violoncellistes aixois')
|
175
|
+
sel.objects << Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
176
|
+
other_sel.objects << Obj.find_by_apidae_id(504)
|
177
|
+
|
178
|
+
assert_equal 2, sel.objects.count
|
179
|
+
assert_equal 1, other_sel.objects.count
|
180
|
+
|
181
|
+
selections_json = File.read('test/data/shared_selections.json')
|
182
|
+
FileImport.add_or_update_selections(proj, selections_json, @result)
|
183
|
+
deletion_json = File.read('test/data/deletion.json')
|
184
|
+
FileImport.delete_objects(deletion_json, @result)
|
185
|
+
|
186
|
+
assert_equal 2, Obj.count
|
187
|
+
assert_equal({created: 0, updated: 0, deleted: 1, selections:
|
188
|
+
[{:apidae_id=>49063, :reference=>"selection-2", :objects=>1}]}, @result)
|
189
|
+
assert_equal 1, other_sel.objects.count
|
190
|
+
end
|
191
|
+
|
169
192
|
test "full import process" do
|
170
193
|
Obj.create(apidae_id: 123, title: 'Objet à supprimer')
|
171
194
|
Obj.create(apidae_id: 4826186, title: 'Objet à mettre à jour')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apidae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- test/data/hot_fr_en.json
|
200
200
|
- test/data/json_export.zip
|
201
201
|
- test/data/selections.json
|
202
|
+
- test/data/shared_selections.json
|
202
203
|
- test/data/structure.json
|
203
204
|
- test/data/update_selections.json
|
204
205
|
- test/dummy/README.rdoc
|
@@ -275,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
276
|
version: '0'
|
276
277
|
requirements: []
|
277
278
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.6.
|
279
|
+
rubygems_version: 2.7.6.2
|
279
280
|
signing_key:
|
280
281
|
specification_version: 4
|
281
282
|
summary: A Ruby on Rails engine for projects that involve Apidae data
|
@@ -341,6 +342,7 @@ test_files:
|
|
341
342
|
- test/controllers/apidae/dashboard_controller_test.rb
|
342
343
|
- test/controllers/apidae/references_controller_test.rb
|
343
344
|
- test/controllers/apidae/import_controller_test.rb
|
345
|
+
- test/data/shared_selections.json
|
344
346
|
- test/data/equ_groups.json
|
345
347
|
- test/data/update_selections.json
|
346
348
|
- test/data/json_export.zip
|