Add more tests for fgdb and gpkg unpacking

pull/14160/merge
Paul Ramsey 6 years ago
parent 11a5dc3ac7
commit f927858932

@ -67,7 +67,7 @@ module CartoDB
.select { |line| line =~ /^\d+/ }
.map { |line| line.match /\d+: \"?(.*?)\"? \(/ }
.map { |line| line[1] }
fgdb_layers.each do |layer|
stdout, stderr, status = Open3.capture3(OGRINFO_BINARY, '-so', source_file.fullpath, layer)
number_rows = stdout.split("\n")

@ -80,7 +80,8 @@ module CartoDB
next if subpath =~ /\.version\.txt/i
fullpath = normalize("#{path}/#{subpath}")
(crawl(fullpath, files) and next) if File.directory?(fullpath)
(crawl(fullpath, files) and next) if
File.directory?(fullpath) and !subpath =~ /\.gdb$/i
files.push(fullpath)
end

Binary file not shown.

@ -25,6 +25,28 @@ describe Unp do
FileUtils.rm_rf(unp.temporary_directory)
end
it 'extracts the contents of a GPKG file' do
zipfile = zipfile_factory(filename: 'geopackage.zip')
unp = Unp.new
unp.run(zipfile)
Dir.entries(unp.temporary_directory).should include('geopackage.gpkg')
unp.source_files.length.should eq 2
(unp.source_files.map { |f| f.layer }).should eq ["pts", "lns"]
FileUtils.rm_rf(unp.temporary_directory)
end
it 'extracts the contents of a FGDB file' do
zipfile = zipfile_factory(filename: 'filegeodatabase.zip')
unp = Unp.new
unp.run(zipfile)
Dir.entries(unp.temporary_directory).should include('filegeodatabase.gdb')
unp.source_files.length.should eq 2
(unp.source_files.map { |f| f.layer }).should eq ["pts", "lns"]
FileUtils.rm_rf(unp.temporary_directory)
end
it 'extracts the contents of a carto file with rar in the name (see #11954)' do
zipfile = zipfile_factory(filename: 'this_is_not_a_rar_file.carto')
unp = Unp.new
@ -160,6 +182,8 @@ describe Unp do
unp.supported?('foo.doc').should eq false
unp.supported?('foo.xls').should eq true
unp.supported?('foo.gpkg').should eq true
unp.supported?('foo.gdb').should eq true
end
end

Loading…
Cancel
Save