curation_concerns 1.1.0 → 1.1.1
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 +4 -4
- data/app/helpers/curation_concerns/main_app_helpers.rb +0 -1
- data/app/services/curation_concerns/file_set_audit_service.rb +15 -3
- data/app/views/collections/_index_default.html.erb +9 -2
- data/lib/curation_concerns/version.rb +1 -1
- data/spec/services/file_set_audit_service_spec.rb +36 -21
- data/spec/services/rights_service_spec.rb +1 -1
- data/spec/views/curation_concerns/base/_form_rights_spec.rb +1 -1
- metadata +2 -3
- data/app/helpers/curation_concerns/blacklight_overrides_helper.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3825d8bd4eec70f2cabd0c06a9f106678d1332a
|
4
|
+
data.tar.gz: 6f58e068e76c09b5b192cda3b9af9466cb58dd9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3815d24ff5b5fbb39308fc59d4d6be90cdc6b871d7d3748d08dc92bf8bb6111f22d4ab9e288d1eb332ecb159e6966378f0d477517b9b1044468b12b8338cf4c
|
7
|
+
data.tar.gz: 261745338ee84efb8078374ca356004e4e4dcf11225940cf71979596449ba786d2c0fb5bbdeea407c96b19b60f03590ebe5ce55473aea90889543dd7b8277178
|
@@ -1,8 +1,15 @@
|
|
1
1
|
module CurationConcerns
|
2
2
|
class FileSetAuditService
|
3
|
-
attr_reader :file_set
|
3
|
+
attr_reader :file_set, :id
|
4
|
+
|
5
|
+
# @param file_set [ActiveFedora::Base, String] file_set
|
4
6
|
def initialize(file_set)
|
5
|
-
|
7
|
+
if file_set.is_a?(String)
|
8
|
+
@id = file_set
|
9
|
+
else
|
10
|
+
@id = file_set.id
|
11
|
+
@file_set = file_set
|
12
|
+
end
|
6
13
|
end
|
7
14
|
|
8
15
|
NO_RUNS = 999
|
@@ -18,7 +25,7 @@ module CurationConcerns
|
|
18
25
|
# Do not try to access the versions if we do not have access to them.
|
19
26
|
# Use this when a file_set is loaded from solr instead of fedora
|
20
27
|
def logged_audit_status
|
21
|
-
audit_results = ChecksumAuditLog.logs_for(
|
28
|
+
audit_results = ChecksumAuditLog.logs_for(id, "original_file")
|
22
29
|
.collect { |result| result["pass"] }
|
23
30
|
|
24
31
|
if audit_results.length > 0
|
@@ -101,5 +108,10 @@ module CurationConcerns
|
|
101
108
|
def days_since_last_audit(latest_audit)
|
102
109
|
(DateTime.now - latest_audit.updated_at.to_date).to_i
|
103
110
|
end
|
111
|
+
|
112
|
+
# Loads the FileSet from Fedora if needed
|
113
|
+
def file_set
|
114
|
+
@file_set ||= FileSet.find(id)
|
115
|
+
end
|
104
116
|
end
|
105
117
|
end
|
@@ -1,2 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<% doc_presenter = index_presenter(document) %>
|
2
|
+
<dl class="document-metadata dl-horizontal dl-invert">
|
3
|
+
<% index_fields(document).each do |field_name, field| -%>
|
4
|
+
<% if should_render_index_field? document, field %>
|
5
|
+
<dt class="blacklight-<%= field_name.parameterize %>"><%= render_index_field_label document, field: field_name %></dt>
|
6
|
+
<dd class="blacklight-<%= field_name.parameterize %>"><%= doc_presenter.field_value field_name %></dd>
|
7
|
+
<% end -%>
|
8
|
+
<% end -%>
|
9
|
+
</dl>
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe CurationConcerns::FileSetAuditService do
|
4
|
-
let(:f)
|
5
|
-
let(:
|
4
|
+
let(:f) { create(:file_set, content: File.open(fixture_file_path('world.png'))) }
|
5
|
+
let(:service_by_object) { described_class.new(f) }
|
6
|
+
let(:service_by_id) { described_class.new(f.id) }
|
6
7
|
|
7
8
|
describe '#audit' do
|
8
9
|
context 'when a file has two versions' do
|
9
10
|
before do
|
10
11
|
CurationConcerns::VersioningService.create(f.original_file) # create a second version -- the factory creates the first version when it attaches +content+
|
11
12
|
end
|
12
|
-
subject {
|
13
|
+
subject { service_by_object.audit[f.original_file.id] }
|
13
14
|
specify 'returns two log results' do
|
14
15
|
expect(subject.length).to eq(2)
|
15
16
|
end
|
@@ -17,14 +18,14 @@ describe CurationConcerns::FileSetAuditService do
|
|
17
18
|
end
|
18
19
|
|
19
20
|
describe '#audit_file' do
|
20
|
-
subject {
|
21
|
+
subject { service_by_object.send(:audit_file, f.original_file) }
|
21
22
|
specify 'returns a single result' do
|
22
23
|
expect(subject.length).to eq(1)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
27
|
describe '#audit_file_version' do
|
27
|
-
subject {
|
28
|
+
subject { service_by_object.send(:audit_file_version, f.original_file.id, f.original_file.uri) }
|
28
29
|
specify 'returns a single ChecksumAuditLog for the given file' do
|
29
30
|
expect(subject).to be_kind_of ChecksumAuditLog
|
30
31
|
expect(subject.file_set_id).to eq(f.id)
|
@@ -33,7 +34,7 @@ describe CurationConcerns::FileSetAuditService do
|
|
33
34
|
end
|
34
35
|
|
35
36
|
describe '#audit_stat' do
|
36
|
-
subject {
|
37
|
+
subject { service_by_object.send(:audit_stat, f.original_file) }
|
37
38
|
context 'when no audits have been run' do
|
38
39
|
it 'reports that audits have not been run' do
|
39
40
|
expect(subject).to eq 'Audits have not yet been run on this file.'
|
@@ -57,42 +58,56 @@ describe CurationConcerns::FileSetAuditService do
|
|
57
58
|
CurationConcerns::VersioningService.create(f.original_file)
|
58
59
|
ChecksumAuditLog.create!(pass: 1, file_set_id: f.id, version: f.original_file.versions.first.uri, file_id: 'original_file')
|
59
60
|
end
|
60
|
-
subject {
|
61
|
+
subject { service_by_object.human_readable_audit_status }
|
61
62
|
it { is_expected.to eq 'Some audits have not been run, but the ones run were passing.' }
|
62
63
|
end
|
63
64
|
|
64
65
|
describe '#logged_audit_status' do
|
65
|
-
|
66
|
+
context "with an object" do
|
67
|
+
subject { service_by_object.logged_audit_status }
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
it "doesn't trigger audits" do
|
70
|
+
expect(service_by_object).not_to receive(:audit_file)
|
71
|
+
expect(subject).to eq "Audits have not yet been run on this file."
|
72
|
+
end
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
context "when no audit is passing" do
|
75
|
+
before do
|
76
|
+
ChecksumAuditLog.create!(pass: 1, file_set_id: f.id, version: f.original_file.versions.first.label, file_id: 'original_file')
|
77
|
+
end
|
78
|
+
|
79
|
+
it "reports the audit result" do
|
80
|
+
expect(subject).to eq 'passing'
|
81
|
+
end
|
75
82
|
end
|
76
83
|
|
77
|
-
|
78
|
-
|
84
|
+
context "when one audit is passing" do
|
85
|
+
before do
|
86
|
+
ChecksumAuditLog.create!(pass: 0, file_set_id: f.id, version: f.original_file.versions.first.label, file_id: 'original_file')
|
87
|
+
ChecksumAuditLog.create!(pass: 1, file_set_id: f.id, version: f.original_file.versions.first.label, file_id: 'original_file')
|
88
|
+
end
|
89
|
+
|
90
|
+
it "reports the audit result" do
|
91
|
+
expect(subject).to eq 'failing'
|
92
|
+
end
|
79
93
|
end
|
80
94
|
end
|
81
95
|
|
82
|
-
context "
|
96
|
+
context "with an id" do
|
97
|
+
subject { service_by_id.logged_audit_status }
|
98
|
+
|
83
99
|
before do
|
84
|
-
ChecksumAuditLog.create!(pass: 0, file_set_id: f.id, version: f.original_file.versions.first.label, file_id: 'original_file')
|
85
100
|
ChecksumAuditLog.create!(pass: 1, file_set_id: f.id, version: f.original_file.versions.first.label, file_id: 'original_file')
|
86
101
|
end
|
87
102
|
|
88
103
|
it "reports the audit result" do
|
89
|
-
expect(subject).to eq '
|
104
|
+
expect(subject).to eq 'passing'
|
90
105
|
end
|
91
106
|
end
|
92
107
|
end
|
93
108
|
|
94
109
|
describe '#stat_to_string' do
|
95
|
-
subject {
|
110
|
+
subject { service_by_object.send(:stat_to_string, val) }
|
96
111
|
context 'when audit_stat is 0' do
|
97
112
|
let(:val) { 0 }
|
98
113
|
it { is_expected.to eq 'failing' }
|
@@ -4,7 +4,7 @@ describe RightsService do
|
|
4
4
|
before do
|
5
5
|
# Configure QA to use fixtures
|
6
6
|
qa_fixtures = { local_path: File.expand_path('../../fixtures/authorities', __FILE__) }
|
7
|
-
|
7
|
+
allow(Qa::Authorities::Local).to receive(:config).and_return(qa_fixtures)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "#select_active_options" do
|
@@ -13,7 +13,7 @@ describe 'curation_concerns/base/_form_rights.html.erb' do
|
|
13
13
|
|
14
14
|
before do
|
15
15
|
qa_fixtures = { local_path: File.expand_path('../../../../fixtures/authorities', __FILE__) }
|
16
|
-
|
16
|
+
allow(Qa::Authorities::Local).to receive(:config).and_return(qa_fixtures)
|
17
17
|
end
|
18
18
|
|
19
19
|
context "when active and inactive rights are associated with a work" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curation_concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-07-
|
13
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hydra-head
|
@@ -717,7 +717,6 @@ files:
|
|
717
717
|
- app/helpers/batch_select_helper.rb
|
718
718
|
- app/helpers/collections_helper.rb
|
719
719
|
- app/helpers/curation_concerns/ability_helper.rb
|
720
|
-
- app/helpers/curation_concerns/blacklight_overrides_helper.rb
|
721
720
|
- app/helpers/curation_concerns/catalog_helper.rb
|
722
721
|
- app/helpers/curation_concerns/collections_helper.rb
|
723
722
|
- app/helpers/curation_concerns/collections_helper_behavior.rb
|