Skip to content

Commit

Permalink
Merge pull request #241 from sul-dlss/more-test-data
Browse files Browse the repository at this point in the history
add 2 more styles of test data per #199
  • Loading branch information
jmartin-sul committed Sep 12, 2018
2 parents cbeff24 + f743d3c commit 915c1c9
Show file tree
Hide file tree
Showing 42 changed files with 99 additions and 52 deletions.
2 changes: 1 addition & 1 deletion spec/lib/bundle_context_temporary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

it "trims the trailing slash from the bundle directory" do
expect(revs_context.bundle_dir).to eq('spec/test_data/bundle_input_a')
expect(revs_context.bundle_dir).to eq('spec/test_data/flat_dir_images')
end

it '#setup_other should prune @file_attr' do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/csv_importer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe CsvImporter do
describe '#parse_to_hash' do
let(:manifest) do
described_class.parse_to_hash("#{Rails.root}/spec/test_data/bundle_input_a/manifest.csv")
described_class.parse_to_hash("#{Rails.root}/spec/test_data/flat_dir_images/manifest.csv")
end

it "loads a CSV as a hash with indifferent access" do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pre_assembly/bundle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
let(:full) { revs.path_in_bundle(relative) }

it "#path_in_bundle returns expected value" do
expect(revs.path_in_bundle(relative)).to eq('spec/test_data/bundle_input_a/abc/def.jpg')
expect(revs.path_in_bundle(relative)).to eq('spec/test_data/flat_dir_images/abc/def.jpg')
end
it "#relative_path returns expected value" do
expect(revs.relative_path(revs.bundle_dir, full)).to eq(relative)
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pre_assembly/digital_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
end
let(:ps) do
context_params.merge(
:bundle_dir => 'spec/test_data/bundle_input_g',
:bundle_dir => 'spec/test_data/images_jp2_tif',
:content_md_creation => { style: 'default' },
:progress_log_file => Tempfile.new('bundle_input_g').path,
:progress_log_file => Tempfile.new('images_jp2_tif').path,
:project_name => 'ProjectBar',
:project_style => {},
:staging_style => 'copy'
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pre_assembly/object_file_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe PreAssembly::ObjectFile do
before do
@f = described_class.new(
:path => 'spec/test_data/bundle_input_a/image1.tif'
:path => 'spec/test_data/flat_dir_images/image1.tif'
)
end

Expand Down
14 changes: 7 additions & 7 deletions spec/models/bundle_context_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RSpec.describe BundleContext, type: :model do
subject(:bc) do
BundleContext.new(
project_name: "SmokeTest",
project_name: "Images jp2 tif",
content_structure: 1,
bundle_dir: "spec/test_data/bundle_input_g/",
bundle_dir: "spec/test_data/images_jp2_tif/",
staging_style_symlink: false,
content_metadata_creation: 1,
user: user
Expand Down Expand Up @@ -66,7 +66,7 @@

context "bundle_dir path does not exist" do
it "object does not pass validation" do
expect { bc.bundle_dir = 'does/not/exist' }.to change { bc.valid? }.to(false)
expect { bc.bundle_dir = 'does/not/exist' }.to change { bc.valid? }.to(false)
end
end

Expand All @@ -85,7 +85,7 @@

describe "#normalize_bundle_dir" do
it "removes the trailing forward slash" do
expect(bc.normalize_bundle_dir).to eq "spec/test_data/bundle_input_g"
expect(bc.normalize_bundle_dir).to eq "spec/test_data/images_jp2_tif"
end
end

Expand All @@ -109,7 +109,7 @@

describe "#path_in_bundle" do
it "creates a relative path" do
expect(bc.path_in_bundle("manifest.csv")).to eq "spec/test_data/bundle_input_g/manifest.csv"
expect(bc.path_in_bundle("manifest.csv")).to eq "spec/test_data/images_jp2_tif/manifest.csv"
end
end

Expand All @@ -119,12 +119,12 @@

describe "manifest_rows" do
it "loads the manifest CSV" do
expect(CsvImporter).to receive(:parse_to_hash).with("spec/test_data/bundle_input_g/manifest.csv")
expect(CsvImporter).to receive(:parse_to_hash).with("spec/test_data/images_jp2_tif/manifest.csv")
bc.manifest_rows
end

it "memoizes the manifest rows" do
expect(CsvImporter).to receive(:parse_to_hash).once.with("spec/test_data/bundle_input_g/manifest.csv").and_call_original
expect(CsvImporter).to receive(:parse_to_hash).once.with("spec/test_data/images_jp2_tif/manifest.csv").and_call_original
2.times { bc.manifest_rows }
end

Expand Down
4 changes: 0 additions & 4 deletions spec/test_data/bundle_input_a/manifest.csv

This file was deleted.

4 changes: 0 additions & 4 deletions spec/test_data/bundle_input_f/manifest.csv

This file was deleted.

Binary file removed spec/test_data/bundle_input_g/gn330dv6119/image1.jp2
Binary file not shown.
Binary file not shown.
Binary file removed spec/test_data/bundle_input_g/gn330dv6119/image2.jp2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed spec/test_data/bundle_input_g/jy812bp9403/05/image1.jp2
Binary file not shown.
4 changes: 0 additions & 4 deletions spec/test_data/bundle_input_g/manifest.csv

This file was deleted.

21 changes: 0 additions & 21 deletions spec/test_data/bundle_input_g/mods_template.xml

This file was deleted.

Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions spec/test_data/flat_dir_images/manifest.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
druid,format,sourceid,filename,label,year,inst_notes,prod_notes,has_more_metadata,description
"druid:oo000oo0000","BW film","foo-1.0","image1.tif","Avus 1937","1937","","",""
"druid:oo111oo1111","BW film","foo-2.1","image2.tif","Avus 1938","1938-1939","frames 6,7,8 glass slide broken","","X",""
"druid:oo222oo2222","BW film","foo-2.2","image3.tif","Avus 1938, 1956","1938, 1956","strip 2 is duplicate; don't scan","","","yo, this is a description"
4 changes: 4 additions & 0 deletions spec/test_data/obj_dirs_images/manifest.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
druid,sourceid,folder,label,description
"druid:oo000oo0000","bar-1.0","obj1","Label 1","This is a description for label 1"
"druid:oo111oo1111","bar-2.1","obj2","Label 2","This is a description for label 1"
"druid:oo222oo2222","bar-2.2","obj3","Label 3","This is a description for label 1"
36 changes: 36 additions & 0 deletions spec/test_data/project_config_files/flat_dir_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# A project which uses a manifest for object discovery, one file per object

project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/flat_dir_images'
staging_dir: 'tmp'
accession_items: ~

manifest: 'manifest.csv'
checksums_file: 'checksums.txt'
desc_md_template: 'mods_template.xml'

progress_log_file: 'log/progress_flat_dir_images.yaml'
project_name: 'Flat Dir Images'

validate_files: false

publish_attr:
publish: 'no'
shelve: 'no'
preserve: 'yes'

content_md_creation:
style: 'none'

stageable_discovery:
glob: ~
regex: ~

manifest_cols:
object_container: 'filename'
source_id: 'sourceid'
label: 'label'

content_exclusion: ~
2 changes: 1 addition & 1 deletion spec/test_data/project_config_files/folder_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_f'
bundle_dir: 'spec/test_data/obj_dirs_images'
staging_dir: 'tmp'
accession_items: ~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_g'
bundle_dir: 'spec/test_data/images_jp2_tif'
staging_dir: 'tmp'
accession_items: ~

Expand Down
36 changes: 36 additions & 0 deletions spec/test_data/project_config_files/obj_dirs_images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# An example of a project which has multiple files per object organized into folders.

project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/obj_dirs_images'
staging_dir: 'tmp'
accession_items: ~

manifest: 'manifest.csv'
checksums_file: ~
desc_md_template: 'mods_template.xml'

progress_log_file: 'log/progress_obj_dirs_images.yaml'
project_name: 'Object Directories with Images'

validate_files: false

publish_attr:
publish: ~
shelve: ~
preserve: ~

content_md_creation:
style: 'none'

stageable_discovery:
glob: ~
regex: ~

manifest_cols:
object_container: 'folder'
source_id: 'sourceid'
label: 'label'

content_exclusion: ~
2 changes: 1 addition & 1 deletion spec/test_data/project_config_files/proj_revs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_a/'
bundle_dir: 'spec/test_data/flat_dir_images/'
staging_dir: 'tmp'
accession_items: ~
manifest: 'manifest.csv'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_a/'
bundle_dir: 'spec/test_data/flat_dir_images/'
staging_dir: 'tmp'
accession_items: ~

Expand Down
2 changes: 1 addition & 1 deletion spec/test_data/project_config_files/proj_revs_no_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_a'
bundle_dir: 'spec/test_data/flat_dir_images'
staging_dir: 'tmp'
accession_items: ~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project_style:
content_structure: 'simple_image'

bundle_dir: 'spec/test_data/bundle_input_a'
bundle_dir: 'spec/test_data/flat_dir_images'
staging_dir: 'tmp'
accession_items: ~

Expand Down

0 comments on commit 915c1c9

Please sign in to comment.