sufia 0.0.1.pre1 → 0.0.1.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/Gemfile +2 -1
- data/README.md +19 -15
- data/Rakefile +2 -0
- data/app/controllers/batch_controller.rb +2 -3
- data/app/controllers/contact_form_controller.rb +1 -0
- data/app/controllers/dashboard_controller.rb +2 -2
- data/app/controllers/generic_files_controller.rb +24 -12
- data/app/controllers/mailbox_controller.rb +2 -2
- data/app/controllers/single_use_link_controller.rb +5 -5
- data/app/controllers/users_controller.rb +10 -10
- data/app/helpers/{application_helper.rb → sufia_helper.rb} +5 -13
- data/app/models/audit_job.rb +3 -4
- data/app/models/batch.rb +2 -0
- data/app/models/batch_update_job.rb +4 -6
- data/app/models/checksum_audit_log.rb +2 -0
- data/app/models/contact_form.rb +2 -0
- data/app/models/content_delete_event_job.rb +1 -1
- data/app/models/content_deposit_event_job.rb +2 -2
- data/app/models/content_new_version_event_job.rb +2 -2
- data/app/models/content_restored_version_event_job.rb +2 -2
- data/app/models/content_update_event_job.rb +2 -2
- data/app/models/datastreams/properties_datastream.rb +1 -1
- data/app/models/domain_term.rb +1 -0
- data/app/models/event_job.rb +1 -1
- data/app/models/generic_file.rb +5 -4
- data/app/models/local_authority.rb +1 -0
- data/app/models/local_authority_entry.rb +1 -0
- data/app/models/single_use_link.rb +2 -2
- data/app/models/user_edit_profile_event_job.rb +1 -1
- data/app/models/user_follow_event_job.rb +2 -2
- data/app/models/user_unfollow_event_job.rb +2 -2
- data/app/models/version_committer.rb +1 -0
- data/app/views/_footer.html.erb +21 -0
- data/app/views/_logo.html.erb +3 -0
- data/app/views/_masthead.html.erb +38 -0
- data/app/views/_user_util_links.html.erb +14 -43
- data/app/views/catalog/_document_list.html.erb +0 -7
- data/app/views/catalog/_home_text.html.erb +4 -4
- data/app/views/catalog/_recent_document.html.erb +5 -5
- data/app/views/contact_form/_directions.html.erb +4 -0
- data/app/views/contact_form/new.html.erb +2 -4
- data/app/views/dashboard/_document_list.html.erb +1 -8
- data/app/views/dashboard/_facets.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +6 -6
- data/app/views/dashboard/_search_form.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +26 -25
- data/app/views/generic_files/_media_display.html.erb +5 -5
- data/app/views/generic_files/_permission.html.erb +11 -11
- data/app/views/generic_files/edit.html.erb +10 -8
- data/app/views/generic_files/show.html.erb +16 -12
- data/app/views/layouts/error.html.erb +2 -53
- data/app/views/layouts/hydra-head.html.erb +2 -21
- data/app/views/mailbox/index.html.erb +1 -1
- data/app/views/static/about.html.erb +2 -65
- data/app/views/static/help.html.erb +1 -721
- data/app/views/users/_search_form.html.erb +1 -1
- data/app/views/users/edit.html.erb +6 -3
- data/config/locales/sufia.en.yml +6 -0
- data/config/routes.rb +1 -3
- data/features/browse_dashboard_files.feature +1 -1
- data/features/display_dashboard.feature +1 -1
- data/features/step_definitions/fixture_steps.rb +2 -2
- data/features/step_definitions/user_steps.rb +12 -8
- data/features/support/env.rb +9 -0
- data/features/support/paths.rb +21 -21
- data/lib/generators/sufia/sufia_generator.rb +46 -4
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
- data/lib/generators/sufia/templates/config/redis_config.rb +20 -0
- data/lib/generators/sufia/templates/config/sufia.rb +29 -0
- data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -4
- data/lib/sufia.rb +22 -15
- data/lib/sufia/active_fedora/redis.rb +49 -0
- data/lib/{generators/sufia/templates/config/active_record_base_redis.rb → sufia/active_record/redis.rb} +1 -16
- data/lib/sufia/controller.rb +1 -2
- data/lib/sufia/http_header_auth.rb +9 -0
- data/lib/sufia/role_mapper.rb +1 -0
- data/lib/sufia/user.rb +24 -6
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/fixtures.rake +245 -0
- data/spec/.gitignore +1 -0
- data/spec/active_fedora/unsaved_digital_object_spec.rb +2 -2
- data/spec/config/host_to_vhost_spec.rb +8 -8
- data/spec/controllers/batch_controller_spec.rb +6 -6
- data/spec/controllers/catalog_controller_spec.rb +2 -0
- data/spec/controllers/dashboard_controller_spec.rb +13 -10
- data/spec/controllers/downloads_controller_spec.rb +8 -8
- data/spec/controllers/generic_files_controller_spec.rb +46 -44
- data/spec/controllers/mailbox_controller_spec.rb +6 -12
- data/spec/controllers/sessions_controller_spec.rb +8 -6
- data/spec/controllers/single_use_link_controller_spec.rb +9 -14
- data/spec/controllers/users_controller_spec.rb +49 -49
- data/spec/{factories.rb → factories/users.rb} +6 -3
- data/spec/fixtures/scholarsphere/scholarsphere_test2.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test3.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test4.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test6.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +12 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +79 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +1 -0
- data/spec/fixtures/scholarsphere/{scholarsphere_test1.foxml.erb → sufia_test1.foxml.erb} +6 -6
- data/spec/fixtures/scholarsphere/{scholarsphere_test5.foxml.erb → sufia_test5.foxml.erb} +5 -5
- data/spec/fixtures/scholarsphere_generic_stub.foxml.erb +5 -5
- data/spec/lib/{scholarsphere → sufia}/id_service_spec.rb +5 -5
- data/spec/lib/{scholarsphere → sufia}/role_mapper_spec.rb +5 -2
- data/spec/models/audit_job_spec.rb +1 -1
- data/spec/models/batch_spec.rb +2 -2
- data/spec/models/batch_update_job_spec.rb +5 -5
- data/spec/models/checksum_audit_log_spec.rb +1 -1
- data/spec/models/event_jobs_spec.rb +19 -19
- data/spec/models/file_content_datastream_spec.rb +6 -6
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +8 -9
- data/spec/models/local_authority_spec.rb +3 -3
- data/spec/models/single_use_link_spec.rb +5 -5
- data/spec/models/unzip_job_spec.rb +1 -1
- data/spec/models/user_spec.rb +5 -26
- data/spec/rake/scholarsphere_fixtures_spec.rb +13 -12
- data/spec/routing/route_spec.rb +4 -41
- data/spec/spec_helper.rb +14 -4
- data/spec/support/Gemfile +21 -0
- data/spec/support/config/redis.yml +6 -0
- data/spec/support/lib/generators/test_app_generator.rb +40 -0
- data/sufia.gemspec +4 -2
- data/tasks/cucumber.rake +0 -6
- data/tasks/jetty.rake +40 -0
- data/tasks/scholarsphere-dev.rake +57 -17
- data/tasks/scholarsphere-fixtures.rake +16 -63
- metadata +74 -55
- data/.rvmrc +0 -59
- data/LICENSE +0 -22
- data/app/assets/images/site_images/logo_psuss_logotype.png +0 -0
- data/app/assets/images/site_images/logo_psuss_shield.png +0 -0
- data/lib/generators/sufia/templates/config/active_fedora_base_redis.rb +0 -54
- data/lib/sufia/ldap.rb +0 -123
- data/spec/fixtures/hydra_test_default_partials.foxml.xml +0 -80
- data/spec/fixtures/hydra_test_generic_content.foxml.xml +0 -138
- data/spec/fixtures/hydra_test_generic_image.foxml.xml +0 -395
- data/spec/fixtures/hydra_test_no_model.foxml.xml +0 -79
- data/spec/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
- data/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
- data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
- data/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
- data/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
- data/spec/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
- data/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
- data/spec/fixtures/hydrus_admin_class1.foxml.xml +0 -176
- data/spec/fixtures/libra-oa_1.foxml.xml +0 -2324
- data/spec/fixtures/libra-oa_2.foxml.xml +0 -2422
- data/spec/fixtures/libra-oa_7.foxml.xml +0 -1735
@@ -0,0 +1 @@
|
|
1
|
+
This is a test fixture for scholarsphere: scholarsphere1.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="
|
2
|
+
<foxml:digitalObject PID="sufia:test1" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
4
|
<foxml:objectProperties>
|
5
5
|
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
@@ -14,14 +14,14 @@
|
|
14
14
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
15
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
16
|
<dc:title>Test Data 1.txt</dc:title>
|
17
|
-
<dc:identifier>
|
17
|
+
<dc:identifier>sufia:test1</dc:identifier>
|
18
18
|
</oai_dc:dc>
|
19
19
|
</foxml:xmlContent>
|
20
20
|
</foxml:datastreamVersion>
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test1.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
@@ -40,7 +40,7 @@
|
|
40
40
|
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
41
41
|
<foxml:xmlContent>
|
42
42
|
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
43
|
-
<rdf:Description rdf:about="info:fedora/
|
43
|
+
<rdf:Description rdf:about="info:fedora/sufia:test1">
|
44
44
|
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
45
45
|
</rdf:Description>
|
46
46
|
</rdf:RDF>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
51
51
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
52
52
|
MIMETYPE="text/plain" SIZE="25">
|
53
|
-
<foxml:contentLocation REF="file
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test1.txt" TYPE="URL"/>
|
54
54
|
</foxml:datastreamVersion>
|
55
55
|
</foxml:datastream>
|
56
56
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -75,7 +75,7 @@
|
|
75
75
|
<access type="edit">
|
76
76
|
<human/>
|
77
77
|
<machine>
|
78
|
-
<person>archivist1</person>
|
78
|
+
<person>archivist1@example.com</person>
|
79
79
|
</machine>
|
80
80
|
</access>
|
81
81
|
<embargo>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="
|
2
|
+
<foxml:digitalObject PID="sufia:test5" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
4
|
<foxml:objectProperties>
|
5
5
|
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
@@ -14,14 +14,14 @@
|
|
14
14
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
15
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
16
|
<dc:title>Test mp3</dc:title>
|
17
|
-
<dc:identifier>
|
17
|
+
<dc:identifier>sufia:test5</dc:identifier>
|
18
18
|
</oai_dc:dc>
|
19
19
|
</foxml:xmlContent>
|
20
20
|
</foxml:datastreamVersion>
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test5.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
@@ -40,7 +40,7 @@
|
|
40
40
|
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
41
41
|
<foxml:xmlContent>
|
42
42
|
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
43
|
-
<rdf:Description rdf:about="info:fedora/
|
43
|
+
<rdf:Description rdf:about="info:fedora/sufia:test5">
|
44
44
|
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
45
45
|
</rdf:Description>
|
46
46
|
</rdf:RDF>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
51
51
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
52
52
|
MIMETYPE="audio/mpeg3" SIZE="25">
|
53
|
-
<foxml:contentLocation REF="file
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test5.mp3" TYPE="URL"/>
|
54
54
|
</foxml:datastreamVersion>
|
55
55
|
</foxml:datastream>
|
56
56
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="<%=
|
2
|
+
<foxml:digitalObject PID="<%=SUFIA_TEST_NS%>:<%= @id %>" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
4
|
<foxml:objectProperties>
|
5
5
|
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
@@ -14,14 +14,14 @@
|
|
14
14
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
15
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
16
|
<dc:title><%= @title %></dc:title>
|
17
|
-
<dc:identifier><%=
|
17
|
+
<dc:identifier><%=SUFIA_TEST_NS%>:<%= @id %></dc:identifier>
|
18
18
|
</oai_dc:dc>
|
19
19
|
</foxml:xmlContent>
|
20
20
|
</foxml:datastreamVersion>
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@root%>/
|
24
|
+
<foxml:contentLocation REF="file:<%=@root%>/scholarsphere/<%=SUFIA_TEST_NS%>_<%= @id %>.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
@@ -29,7 +29,7 @@
|
|
29
29
|
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml">
|
30
30
|
<foxml:xmlContent>
|
31
31
|
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
32
|
-
<rdf:Description rdf:about="info:fedora/<%=
|
32
|
+
<rdf:Description rdf:about="info:fedora/<%=SUFIA_TEST_NS%>:<%= @id %>">
|
33
33
|
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
34
34
|
</rdf:Description>
|
35
35
|
</rdf:RDF>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
40
40
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
41
41
|
MIMETYPE="text/plain" >
|
42
|
-
<foxml:contentLocation REF="file:<%=@root%>/
|
42
|
+
<foxml:contentLocation REF="file:<%=@root%>/scholarsphere/<%=SUFIA_TEST_NS%>_<%= @id %>.txt" TYPE="URL"/>
|
43
43
|
</foxml:datastreamVersion>
|
44
44
|
</foxml:datastream>
|
45
45
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -14,16 +14,16 @@
|
|
14
14
|
|
15
15
|
require 'spec_helper'
|
16
16
|
|
17
|
-
describe
|
17
|
+
describe Sufia::IdService do
|
18
18
|
describe "mint" do
|
19
19
|
before(:all) do
|
20
|
-
@id =
|
20
|
+
@id = Sufia::IdService.mint
|
21
21
|
end
|
22
22
|
it "should create a unique id" do
|
23
23
|
@id.should_not be_empty
|
24
24
|
end
|
25
25
|
it "should not mint the same id twice in a row" do
|
26
|
-
other_id =
|
26
|
+
other_id = Sufia::IdService.mint
|
27
27
|
other_id.should_not == @id
|
28
28
|
end
|
29
29
|
it "should create many unique ids" do
|
@@ -31,7 +31,7 @@ describe ScholarSphere::IdService do
|
|
31
31
|
threads = (1..10).map do
|
32
32
|
Thread.new do
|
33
33
|
100.times do
|
34
|
-
a <<
|
34
|
+
a << Sufia::IdService.mint
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -46,7 +46,7 @@ describe ScholarSphere::IdService do
|
|
46
46
|
threads = (1..10).map do
|
47
47
|
Thread.new do
|
48
48
|
20.times do
|
49
|
-
wr.write
|
49
|
+
wr.write Sufia::IdService.mint
|
50
50
|
wr.write " "
|
51
51
|
end
|
52
52
|
end
|
@@ -19,7 +19,10 @@ describe RoleMapper do
|
|
19
19
|
@user = FactoryGirl.create(:user)
|
20
20
|
User.any_instance.stubs(:groups).returns(["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"])
|
21
21
|
end
|
22
|
-
subject {::RoleMapper.roles(@user.
|
23
|
-
it
|
22
|
+
subject {::RoleMapper.roles(@user.user_key)}
|
23
|
+
it "should return LDAP groups" do
|
24
|
+
pending "This is for Penn only"
|
25
|
+
subject.should == ["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"]
|
26
|
+
end
|
24
27
|
end
|
25
28
|
|
@@ -21,7 +21,7 @@ describe AuditJob do
|
|
21
21
|
GenericFile.any_instance.expects(:characterize_if_changed).yields
|
22
22
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
23
23
|
@file = GenericFile.new
|
24
|
-
@file.apply_depositor_metadata(@user.
|
24
|
+
@file.apply_depositor_metadata(@user.user_key)
|
25
25
|
@file.save
|
26
26
|
@ds = @file.datastreams.first
|
27
27
|
end
|
data/spec/models/batch_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Batch do
|
|
23
23
|
@file.apply_depositor_metadata('mjg36')
|
24
24
|
@file.save
|
25
25
|
@batch = Batch.create(:title => "test collection",
|
26
|
-
:creator => @user.
|
26
|
+
:creator => @user.user_key,
|
27
27
|
:part => @file.pid)
|
28
28
|
end
|
29
29
|
after(:all) do
|
@@ -38,7 +38,7 @@ describe Batch do
|
|
38
38
|
@batch.descMetadata.should be_kind_of BatchRdfDatastream
|
39
39
|
end
|
40
40
|
it "should belong to testuser" do
|
41
|
-
@batch.creator.should == [@user.
|
41
|
+
@batch.creator.should == [@user.user_key]
|
42
42
|
end
|
43
43
|
it "should be titled 'test collection'" do
|
44
44
|
@batch.title.should == ["test collection"]
|
@@ -21,7 +21,7 @@ describe BatchUpdateJob do
|
|
21
21
|
@batch = Batch.new
|
22
22
|
@batch.save
|
23
23
|
@file = GenericFile.new(:batch=>@batch)
|
24
|
-
@file.apply_depositor_metadata(@user.
|
24
|
+
@file.apply_depositor_metadata(@user.user_key)
|
25
25
|
@file.save
|
26
26
|
@file2 = GenericFile.new(:batch=>@batch)
|
27
27
|
@file2.apply_depositor_metadata('otherUser')
|
@@ -39,7 +39,7 @@ describe BatchUpdateJob do
|
|
39
39
|
BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
|
40
40
|
User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2)
|
41
41
|
params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
|
42
|
-
BatchUpdateJob.perform(@user.
|
42
|
+
BatchUpdateJob.perform(@user.user_key, params, params[:generic_file])
|
43
43
|
@user.mailbox.inbox[0].messages[0].subject.should == "Batch upload permission denied"
|
44
44
|
@user.mailbox.inbox[0].messages[0].move_to_trash @user
|
45
45
|
#b = Batch.find(@batch.pid)
|
@@ -49,10 +49,10 @@ describe BatchUpdateJob do
|
|
49
49
|
it "should log a content update event" do
|
50
50
|
BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
|
51
51
|
User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2).returns(true)
|
52
|
-
Resque.expects(:enqueue).with(ContentUpdateEventJob, @file.pid, @user.
|
53
|
-
Resque.expects(:enqueue).with(ContentUpdateEventJob, @file2.pid, @user.
|
52
|
+
Resque.expects(:enqueue).with(ContentUpdateEventJob, @file.pid, @user.user_key).once
|
53
|
+
Resque.expects(:enqueue).with(ContentUpdateEventJob, @file2.pid, @user.user_key).once
|
54
54
|
params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
|
55
|
-
BatchUpdateJob.perform(@user.
|
55
|
+
BatchUpdateJob.perform(@user.user_key, params, params[:generic_file])
|
56
56
|
@user.mailbox.inbox[0].messages[0].subject.should == "Batch upload complete"
|
57
57
|
@user.mailbox.inbox[0].messages[0].move_to_trash @user
|
58
58
|
end
|
@@ -19,7 +19,7 @@ describe ChecksumAuditLog do
|
|
19
19
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
20
20
|
GenericFile.any_instance.stubs(:characterize).returns(true) # stub out characterization so it does not get audited
|
21
21
|
@f = GenericFile.new
|
22
|
-
@f.add_file_datastream(File.new(
|
22
|
+
@f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
23
23
|
@f.apply_depositor_metadata('mjg36')
|
24
24
|
@f.save
|
25
25
|
@version = @f.datastreams['content'].versions.first
|
@@ -21,7 +21,7 @@ describe 'event jobs' do
|
|
21
21
|
@third_user = FactoryGirl.find_or_create(:curator)
|
22
22
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
23
23
|
@gf = GenericFile.new(pid: 'test:123')
|
24
|
-
@gf.apply_depositor_metadata(@user.
|
24
|
+
@gf.apply_depositor_metadata(@user.user_key)
|
25
25
|
@gf.title = 'Hamlet'
|
26
26
|
@gf.save
|
27
27
|
end
|
@@ -40,8 +40,8 @@ describe 'event jobs' do
|
|
40
40
|
count_user = @user.events.length
|
41
41
|
count_another = @another_user.events.length
|
42
42
|
Time.expects(:now).returns(1).at_least_once
|
43
|
-
event = { action: 'User <a href="/users/jilluser">jilluser</a> has edited his or her profile', timestamp: '1' }
|
44
|
-
UserEditProfileEventJob.perform(@user.
|
43
|
+
event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has edited his or her profile', timestamp: '1' }
|
44
|
+
UserEditProfileEventJob.perform(@user.user_key)
|
45
45
|
@user.events.length.should == count_user + 1
|
46
46
|
@user.events.first.should == event
|
47
47
|
@another_user.events.length.should == count_another + 1
|
@@ -54,8 +54,8 @@ describe 'event jobs' do
|
|
54
54
|
@another_user.events.length.should == 0
|
55
55
|
@third_user.events.length.should == 0
|
56
56
|
Time.expects(:now).returns(1).at_least_once
|
57
|
-
event = { action: 'User <a href="/users/jilluser">jilluser</a> is now following <a href="/users/archivist1">archivist1</a>', timestamp: '1' }
|
58
|
-
UserFollowEventJob.perform(@user.
|
57
|
+
event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> is now following <a href="/users/archivist1@example.com">archivist1@example.com</a>', timestamp: '1' }
|
58
|
+
UserFollowEventJob.perform(@user.user_key, @another_user.user_key)
|
59
59
|
@user.events.length.should == 1
|
60
60
|
@user.events.first.should == event
|
61
61
|
@another_user.events.length.should == 1
|
@@ -71,8 +71,8 @@ describe 'event jobs' do
|
|
71
71
|
@another_user.events.length.should == 0
|
72
72
|
@third_user.events.length.should == 0
|
73
73
|
Time.expects(:now).returns(1).at_least_once
|
74
|
-
event = { action: 'User <a href="/users/jilluser">jilluser</a> has unfollowed <a href="/users/archivist1">archivist1</a>', timestamp: '1' }
|
75
|
-
UserUnfollowEventJob.perform(@user.
|
74
|
+
event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has unfollowed <a href="/users/archivist1@example.com">archivist1@example.com</a>', timestamp: '1' }
|
75
|
+
UserUnfollowEventJob.perform(@user.user_key, @another_user.user_key)
|
76
76
|
@user.events.length.should == 1
|
77
77
|
@user.events.first.should == event
|
78
78
|
@another_user.events.length.should == 1
|
@@ -90,8 +90,8 @@ describe 'event jobs' do
|
|
90
90
|
@third_user.events.length.should == 0
|
91
91
|
@gf.events.length.should == 0
|
92
92
|
Time.expects(:now).returns(1).at_least_once
|
93
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has deposited <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
94
|
-
ContentDepositEventJob.perform('test:123', @user.
|
93
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has deposited <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
94
|
+
ContentDepositEventJob.perform('test:123', @user.user_key)
|
95
95
|
@user.profile_events.length.should == 1
|
96
96
|
@user.profile_events.first.should == event
|
97
97
|
@another_user.events.length.should == 1
|
@@ -111,8 +111,8 @@ describe 'event jobs' do
|
|
111
111
|
@third_user.events.length.should == 0
|
112
112
|
@gf.events.length.should == 0
|
113
113
|
Time.expects(:now).returns(1).at_least_once
|
114
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has updated <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
115
|
-
ContentUpdateEventJob.perform('test:123', @user.
|
114
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has updated <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
115
|
+
ContentUpdateEventJob.perform('test:123', @user.user_key)
|
116
116
|
@user.profile_events.length.should == 1
|
117
117
|
@user.profile_events.first.should == event
|
118
118
|
@another_user.events.length.should == 1
|
@@ -132,8 +132,8 @@ describe 'event jobs' do
|
|
132
132
|
@third_user.events.length.should == 0
|
133
133
|
@gf.events.length.should == 0
|
134
134
|
Time.expects(:now).returns(1).at_least_once
|
135
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has added a new version of <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
136
|
-
ContentNewVersionEventJob.perform('test:123', @user.
|
135
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has added a new version of <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
136
|
+
ContentNewVersionEventJob.perform('test:123', @user.user_key)
|
137
137
|
@user.profile_events.length.should == 1
|
138
138
|
@user.profile_events.first.should == event
|
139
139
|
@another_user.events.length.should == 1
|
@@ -153,8 +153,8 @@ describe 'event jobs' do
|
|
153
153
|
@third_user.events.length.should == 0
|
154
154
|
@gf.events.length.should == 0
|
155
155
|
Time.expects(:now).returns(1).at_least_once
|
156
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has restored a version \'content.0\' of <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
157
|
-
ContentRestoredVersionEventJob.perform('test:123', @user.
|
156
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has restored a version \'content.0\' of <a href="/files/123">Hamlet</a>', timestamp: '1' }
|
157
|
+
ContentRestoredVersionEventJob.perform('test:123', @user.user_key, 'content.0')
|
158
158
|
@user.profile_events.length.should == 1
|
159
159
|
@user.profile_events.first.should == event
|
160
160
|
@another_user.events.length.should == 1
|
@@ -172,8 +172,8 @@ describe 'event jobs' do
|
|
172
172
|
@another_user.events.length.should == 0
|
173
173
|
@third_user.events.length.should == 0
|
174
174
|
Time.expects(:now).returns(1).at_least_once
|
175
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has deleted file \'test:123\'', timestamp: '1' }
|
176
|
-
ContentDeleteEventJob.perform('test:123', @user.
|
175
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has deleted file \'test:123\'', timestamp: '1' }
|
176
|
+
ContentDeleteEventJob.perform('test:123', @user.user_key)
|
177
177
|
@user.profile_events.length.should == 1
|
178
178
|
@user.profile_events.first.should == event
|
179
179
|
@another_user.events.length.should == 1
|
@@ -191,8 +191,8 @@ describe 'event jobs' do
|
|
191
191
|
@gf.events.length.should == 0
|
192
192
|
@now = Time.now
|
193
193
|
Time.expects(:now).returns(@now).at_least_once
|
194
|
-
event = {action: 'User <a href="/users/jilluser">jilluser</a> has updated <a href="/files/123">Hamlet</a>', timestamp: @now.to_i.to_s }
|
195
|
-
ContentUpdateEventJob.perform('test:123', @user.
|
194
|
+
event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has updated <a href="/files/123">Hamlet</a>', timestamp: @now.to_i.to_s }
|
195
|
+
ContentUpdateEventJob.perform('test:123', @user.user_key)
|
196
196
|
@user.profile_events.length.should == 1
|
197
197
|
@user.profile_events.first.should == event
|
198
198
|
@another_user.events.length.should == 0
|
@@ -25,7 +25,7 @@ describe FileContentDatastream do
|
|
25
25
|
before(:all) do
|
26
26
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
27
27
|
f = GenericFile.new
|
28
|
-
f.add_file_datastream(File.new(
|
28
|
+
f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
29
29
|
f.expects(:characterize_if_changed).yields
|
30
30
|
f.apply_depositor_metadata('mjg36')
|
31
31
|
f.save
|
@@ -51,7 +51,7 @@ describe FileContentDatastream do
|
|
51
51
|
end
|
52
52
|
describe "add a version" do
|
53
53
|
before(:all) do
|
54
|
-
@file.add_file_datastream(File.new(
|
54
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
55
55
|
@file.expects(:characterize_if_changed).yields
|
56
56
|
@file.save
|
57
57
|
end
|
@@ -74,7 +74,7 @@ describe FileContentDatastream do
|
|
74
74
|
it "should return an xml document" do
|
75
75
|
repo = mock("repo")
|
76
76
|
repo.stubs(:config=>{})
|
77
|
-
f = File.new(
|
77
|
+
f = File.new(fixture_path + '/world.png')
|
78
78
|
content = mock("file")
|
79
79
|
content.stubs(:read=>f.read)
|
80
80
|
content.stubs(:rewind=>f.rewind)
|
@@ -86,7 +86,7 @@ describe FileContentDatastream do
|
|
86
86
|
it "should return expected results when invoked via HTTP" do
|
87
87
|
repo = mock("repo")
|
88
88
|
repo.stubs(:config=>{})
|
89
|
-
f = ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(
|
89
|
+
f = ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(fixture_path + '/world.png'),
|
90
90
|
:filename => 'world.png')
|
91
91
|
content = mock("file")
|
92
92
|
content.stubs(:read=>f.read)
|
@@ -106,13 +106,13 @@ describe FileContentDatastream do
|
|
106
106
|
@generic_file.delete
|
107
107
|
end
|
108
108
|
it "should only return true when the datastream has actually changed" do
|
109
|
-
@generic_file.add_file_datastream(File.new(
|
109
|
+
@generic_file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
110
110
|
@generic_file.content.changed?.should be_true
|
111
111
|
@generic_file.save
|
112
112
|
@generic_file.content.changed?.should be_false
|
113
113
|
|
114
114
|
# Add a thumbnail ds
|
115
|
-
@generic_file.add_file_datastream(File.new(
|
115
|
+
@generic_file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'thumbnail')
|
116
116
|
@generic_file.thumbnail.changed?.should be_true
|
117
117
|
@generic_file.content.changed?.should be_false
|
118
118
|
|
@@ -18,7 +18,7 @@ describe FitsDatastream do
|
|
18
18
|
before(:all) do
|
19
19
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
20
20
|
@file = GenericFile.new
|
21
|
-
@file.add_file_datastream(File.new(
|
21
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
22
22
|
@file.apply_depositor_metadata('mjg36')
|
23
23
|
@file.save
|
24
24
|
@file = GenericFile.find(@file.pid)
|
@@ -86,7 +86,7 @@ describe GenericFile do
|
|
86
86
|
@file.descMetadata.should be_kind_of GenericFileRdfDatastream
|
87
87
|
end
|
88
88
|
it "should have content datastream" do
|
89
|
-
@file.add_file_datastream(File.new(
|
89
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
90
90
|
@file.content.should be_kind_of FileContentDatastream
|
91
91
|
end
|
92
92
|
end
|
@@ -228,8 +228,7 @@ describe GenericFile do
|
|
228
228
|
before do
|
229
229
|
@f = GenericFile.new
|
230
230
|
@f.stubs(:mime_type=>'image/png', :width=>['50'], :height=>['50']) #Would get set by the characterization job
|
231
|
-
@f.
|
232
|
-
@f.add_file_datastream(File.new("#{Rails.root}/spec/fixtures/world.png"), :dsid=>'content')
|
231
|
+
@f.add_file_datastream(File.new("#{fixture_path}/world.png"), :dsid=>'content')
|
233
232
|
@f.apply_depositor_metadata('mjg36')
|
234
233
|
@f.save
|
235
234
|
@mock_image = mock("image", :from_blob=>true)
|
@@ -251,7 +250,7 @@ describe GenericFile do
|
|
251
250
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
252
251
|
GenericFile.any_instance.stubs(:characterize).returns(true)
|
253
252
|
f = GenericFile.new
|
254
|
-
f.add_file_datastream(File.new(
|
253
|
+
f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
255
254
|
f.apply_depositor_metadata('mjg36')
|
256
255
|
f.save
|
257
256
|
@f = GenericFile.find(f.pid)
|
@@ -287,7 +286,7 @@ describe GenericFile do
|
|
287
286
|
@file.delete
|
288
287
|
end
|
289
288
|
it "should schedule a characterization job" do
|
290
|
-
@file.add_file_datastream(File.new(
|
289
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
291
290
|
Resque.expects(:enqueue).once
|
292
291
|
@file.save
|
293
292
|
end
|
@@ -387,14 +386,14 @@ describe GenericFile do
|
|
387
386
|
@new_file.noid.should == '123'
|
388
387
|
end
|
389
388
|
it "should work outside of an instance" do
|
390
|
-
new_id =
|
389
|
+
new_id = Sufia::IdService.mint
|
391
390
|
noid = new_id.split(':').last
|
392
|
-
|
391
|
+
Sufia::Noid.noidify(new_id).should == noid
|
393
392
|
end
|
394
393
|
end
|
395
394
|
describe "characterize" do
|
396
395
|
it "should return expected results when called" do
|
397
|
-
@file.add_file_datastream(File.new(
|
396
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
398
397
|
@file.characterize
|
399
398
|
doc = Nokogiri::XML.parse(@file.characterization.content)
|
400
399
|
doc.root.xpath('//ns:imageWidth/text()', {'ns'=>'http://hul.harvard.edu/ois/xml/ns/fits/fits_output'}).inner_text.should == '50'
|
@@ -412,7 +411,7 @@ describe GenericFile do
|
|
412
411
|
before(:all) do
|
413
412
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
414
413
|
myfile = GenericFile.new
|
415
|
-
myfile.add_file_datastream(File.new(
|
414
|
+
myfile.add_file_datastream(File.new(fixture_path + '/scholarsphere/scholarsphere_test4.pdf'), :dsid=>'content')
|
416
415
|
myfile.label = 'label123'
|
417
416
|
myfile.thumbnail.size.nil?.should be_true
|
418
417
|
myfile.apply_depositor_metadata('mjg36')
|