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.
Files changed (151) hide show
  1. data/.gitignore +1 -2
  2. data/Gemfile +2 -1
  3. data/README.md +19 -15
  4. data/Rakefile +2 -0
  5. data/app/controllers/batch_controller.rb +2 -3
  6. data/app/controllers/contact_form_controller.rb +1 -0
  7. data/app/controllers/dashboard_controller.rb +2 -2
  8. data/app/controllers/generic_files_controller.rb +24 -12
  9. data/app/controllers/mailbox_controller.rb +2 -2
  10. data/app/controllers/single_use_link_controller.rb +5 -5
  11. data/app/controllers/users_controller.rb +10 -10
  12. data/app/helpers/{application_helper.rb → sufia_helper.rb} +5 -13
  13. data/app/models/audit_job.rb +3 -4
  14. data/app/models/batch.rb +2 -0
  15. data/app/models/batch_update_job.rb +4 -6
  16. data/app/models/checksum_audit_log.rb +2 -0
  17. data/app/models/contact_form.rb +2 -0
  18. data/app/models/content_delete_event_job.rb +1 -1
  19. data/app/models/content_deposit_event_job.rb +2 -2
  20. data/app/models/content_new_version_event_job.rb +2 -2
  21. data/app/models/content_restored_version_event_job.rb +2 -2
  22. data/app/models/content_update_event_job.rb +2 -2
  23. data/app/models/datastreams/properties_datastream.rb +1 -1
  24. data/app/models/domain_term.rb +1 -0
  25. data/app/models/event_job.rb +1 -1
  26. data/app/models/generic_file.rb +5 -4
  27. data/app/models/local_authority.rb +1 -0
  28. data/app/models/local_authority_entry.rb +1 -0
  29. data/app/models/single_use_link.rb +2 -2
  30. data/app/models/user_edit_profile_event_job.rb +1 -1
  31. data/app/models/user_follow_event_job.rb +2 -2
  32. data/app/models/user_unfollow_event_job.rb +2 -2
  33. data/app/models/version_committer.rb +1 -0
  34. data/app/views/_footer.html.erb +21 -0
  35. data/app/views/_logo.html.erb +3 -0
  36. data/app/views/_masthead.html.erb +38 -0
  37. data/app/views/_user_util_links.html.erb +14 -43
  38. data/app/views/catalog/_document_list.html.erb +0 -7
  39. data/app/views/catalog/_home_text.html.erb +4 -4
  40. data/app/views/catalog/_recent_document.html.erb +5 -5
  41. data/app/views/contact_form/_directions.html.erb +4 -0
  42. data/app/views/contact_form/new.html.erb +2 -4
  43. data/app/views/dashboard/_document_list.html.erb +1 -8
  44. data/app/views/dashboard/_facets.html.erb +1 -1
  45. data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -1
  46. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +6 -6
  47. data/app/views/dashboard/_search_form.html.erb +1 -1
  48. data/app/views/dashboard/index.html.erb +26 -25
  49. data/app/views/generic_files/_media_display.html.erb +5 -5
  50. data/app/views/generic_files/_permission.html.erb +11 -11
  51. data/app/views/generic_files/edit.html.erb +10 -8
  52. data/app/views/generic_files/show.html.erb +16 -12
  53. data/app/views/layouts/error.html.erb +2 -53
  54. data/app/views/layouts/hydra-head.html.erb +2 -21
  55. data/app/views/mailbox/index.html.erb +1 -1
  56. data/app/views/static/about.html.erb +2 -65
  57. data/app/views/static/help.html.erb +1 -721
  58. data/app/views/users/_search_form.html.erb +1 -1
  59. data/app/views/users/edit.html.erb +6 -3
  60. data/config/locales/sufia.en.yml +6 -0
  61. data/config/routes.rb +1 -3
  62. data/features/browse_dashboard_files.feature +1 -1
  63. data/features/display_dashboard.feature +1 -1
  64. data/features/step_definitions/fixture_steps.rb +2 -2
  65. data/features/step_definitions/user_steps.rb +12 -8
  66. data/features/support/env.rb +9 -0
  67. data/features/support/paths.rb +21 -21
  68. data/lib/generators/sufia/sufia_generator.rb +46 -4
  69. data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
  70. data/lib/generators/sufia/templates/config/redis_config.rb +20 -0
  71. data/lib/generators/sufia/templates/config/sufia.rb +29 -0
  72. data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -4
  73. data/lib/sufia.rb +22 -15
  74. data/lib/sufia/active_fedora/redis.rb +49 -0
  75. data/lib/{generators/sufia/templates/config/active_record_base_redis.rb → sufia/active_record/redis.rb} +1 -16
  76. data/lib/sufia/controller.rb +1 -2
  77. data/lib/sufia/http_header_auth.rb +9 -0
  78. data/lib/sufia/role_mapper.rb +1 -0
  79. data/lib/sufia/user.rb +24 -6
  80. data/lib/sufia/version.rb +1 -1
  81. data/lib/tasks/fixtures.rake +245 -0
  82. data/spec/.gitignore +1 -0
  83. data/spec/active_fedora/unsaved_digital_object_spec.rb +2 -2
  84. data/spec/config/host_to_vhost_spec.rb +8 -8
  85. data/spec/controllers/batch_controller_spec.rb +6 -6
  86. data/spec/controllers/catalog_controller_spec.rb +2 -0
  87. data/spec/controllers/dashboard_controller_spec.rb +13 -10
  88. data/spec/controllers/downloads_controller_spec.rb +8 -8
  89. data/spec/controllers/generic_files_controller_spec.rb +46 -44
  90. data/spec/controllers/mailbox_controller_spec.rb +6 -12
  91. data/spec/controllers/sessions_controller_spec.rb +8 -6
  92. data/spec/controllers/single_use_link_controller_spec.rb +9 -14
  93. data/spec/controllers/users_controller_spec.rb +49 -49
  94. data/spec/{factories.rb → factories/users.rb} +6 -3
  95. data/spec/fixtures/scholarsphere/scholarsphere_test2.foxml.erb +2 -2
  96. data/spec/fixtures/scholarsphere/scholarsphere_test3.foxml.erb +2 -2
  97. data/spec/fixtures/scholarsphere/scholarsphere_test4.foxml.erb +2 -2
  98. data/spec/fixtures/scholarsphere/scholarsphere_test6.foxml.erb +2 -2
  99. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +12 -0
  100. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +79 -0
  101. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +1 -0
  102. data/spec/fixtures/scholarsphere/{scholarsphere_test1.foxml.erb → sufia_test1.foxml.erb} +6 -6
  103. data/spec/fixtures/scholarsphere/{scholarsphere_test5.foxml.erb → sufia_test5.foxml.erb} +5 -5
  104. data/spec/fixtures/scholarsphere_generic_stub.foxml.erb +5 -5
  105. data/spec/lib/{scholarsphere → sufia}/id_service_spec.rb +5 -5
  106. data/spec/lib/{scholarsphere → sufia}/role_mapper_spec.rb +5 -2
  107. data/spec/models/audit_job_spec.rb +1 -1
  108. data/spec/models/batch_spec.rb +2 -2
  109. data/spec/models/batch_update_job_spec.rb +5 -5
  110. data/spec/models/checksum_audit_log_spec.rb +1 -1
  111. data/spec/models/event_jobs_spec.rb +19 -19
  112. data/spec/models/file_content_datastream_spec.rb +6 -6
  113. data/spec/models/fits_datastream_spec.rb +1 -1
  114. data/spec/models/generic_file_spec.rb +8 -9
  115. data/spec/models/local_authority_spec.rb +3 -3
  116. data/spec/models/single_use_link_spec.rb +5 -5
  117. data/spec/models/unzip_job_spec.rb +1 -1
  118. data/spec/models/user_spec.rb +5 -26
  119. data/spec/rake/scholarsphere_fixtures_spec.rb +13 -12
  120. data/spec/routing/route_spec.rb +4 -41
  121. data/spec/spec_helper.rb +14 -4
  122. data/spec/support/Gemfile +21 -0
  123. data/spec/support/config/redis.yml +6 -0
  124. data/spec/support/lib/generators/test_app_generator.rb +40 -0
  125. data/sufia.gemspec +4 -2
  126. data/tasks/cucumber.rake +0 -6
  127. data/tasks/jetty.rake +40 -0
  128. data/tasks/scholarsphere-dev.rake +57 -17
  129. data/tasks/scholarsphere-fixtures.rake +16 -63
  130. metadata +74 -55
  131. data/.rvmrc +0 -59
  132. data/LICENSE +0 -22
  133. data/app/assets/images/site_images/logo_psuss_logotype.png +0 -0
  134. data/app/assets/images/site_images/logo_psuss_shield.png +0 -0
  135. data/lib/generators/sufia/templates/config/active_fedora_base_redis.rb +0 -54
  136. data/lib/sufia/ldap.rb +0 -123
  137. data/spec/fixtures/hydra_test_default_partials.foxml.xml +0 -80
  138. data/spec/fixtures/hydra_test_generic_content.foxml.xml +0 -138
  139. data/spec/fixtures/hydra_test_generic_image.foxml.xml +0 -395
  140. data/spec/fixtures/hydra_test_no_model.foxml.xml +0 -79
  141. data/spec/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
  142. data/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
  143. data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
  144. data/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
  145. data/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
  146. data/spec/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
  147. data/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
  148. data/spec/fixtures/hydrus_admin_class1.foxml.xml +0 -176
  149. data/spec/fixtures/libra-oa_1.foxml.xml +0 -2324
  150. data/spec/fixtures/libra-oa_2.foxml.xml +0 -2422
  151. 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="scholarsphere:test1" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
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>scholarsphere:test1</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:<%=Rails.root%>/spec/fixtures/scholarsphere/scholarsphere_test1.descMeta.txt" TYPE="URL"/>
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/scholarsphere:test1">
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:<%=Rails.root%>/spec/fixtures/scholarsphere/scholarsphere_test1.txt" TYPE="URL"/>
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="scholarsphere:test5" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
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>scholarsphere:test5</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:<%=Rails.root%>/spec/fixtures/scholarsphere/scholarsphere_test5.descMeta.txt" TYPE="URL"/>
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/scholarsphere:test5">
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:<%=Rails.root%>/spec/fixtures/scholarsphere/scholarsphere_test5.mp3" TYPE="URL"/>
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="<%=ScholarSphere::Application.config.id_namespace%>:<%= @id %>" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
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><%=ScholarSphere::Application.config.id_namespace%>:<%= @id %></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%>/spec/fixtures/scholarsphere/<%=ScholarSphere::Application.config.id_namespace%>_<%= @id %>.descMeta.txt" TYPE="URL"/>
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/<%=ScholarSphere::Application.config.id_namespace%>:<%= @id %>">
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%>/spec/fixtures/scholarsphere/<%=ScholarSphere::Application.config.id_namespace%>_<%= @id %>.txt" TYPE="URL"/>
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 ScholarSphere::IdService do
17
+ describe Sufia::IdService do
18
18
  describe "mint" do
19
19
  before(:all) do
20
- @id = ScholarSphere::IdService.mint
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 = ScholarSphere::IdService.mint
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 << ScholarSphere::IdService.mint
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 ScholarSphere::IdService.mint
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.login)}
23
- it { should == ["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"]}
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.login)
24
+ @file.apply_depositor_metadata(@user.user_key)
25
25
  @file.save
26
26
  @ds = @file.datastreams.first
27
27
  end
@@ -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.login,
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.login]
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.login)
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.login, params, params[:generic_file])
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.login).once
53
- Resque.expects(:enqueue).with(ContentUpdateEventJob, @file2.pid, @user.login).once
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.login, params, params[:generic_file])
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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.login)
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.login)
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.login, @another_user.login)
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.login, @another_user.login)
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.login)
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.login)
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.login)
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.login, 'content.0')
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.login)
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.login)
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/world.png')
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(Rails.root + 'spec/fixtures/world.png'),
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'thumbnail')
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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.stubs(:to_solr).returns({})
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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 = ScholarSphere::IdService.mint
389
+ new_id = Sufia::IdService.mint
391
390
  noid = new_id.split(':').last
392
- ScholarSphere::Noid.noidify(new_id).should == noid
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(Rails.root + 'spec/fixtures/world.png'), :dsid=>'content')
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(Rails.root + 'spec/fixtures/scholarsphere/scholarsphere_test4.pdf'), :dsid=>'content')
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')