Skip to content
Browse files

Merge pull request #23 from minio-sk/portable-tests

Make the tests portable
  • Loading branch information...
2 parents 085f5f6 + 6b5901e commit 28fef697f539dc957d935163d67004aba2b615e1 @jashkenas jashkenas committed
26 test/fixtures/corrosion/corrosion_1.txt
@@ -1,26 +0,0 @@
- 901 Locust Street Suite 462
-Qi' Kansas City, MO 164106-2641
-Pipetine and
-Hazardous Materials Satety
-January 21, 2010
-Mr. Terry McGill, President
-Enbridge Energy Partners, L.P.
-1100 Louisiana, Suite 3300 -
-Houston, Texas 77002
-Dear Mr. McGill:
-On October 6-8, 2008, October 28, 2008, and January 21-22, 2009, a representative of the
-Pipeline and Hazardous Materials Safety Administration (PHMSA) pursuant to Chapter 601 of
-49 United States Code inspected your facilities associated With the Griffith Unit in Griffith,
-Indiana, and surrounding locations.
-As a result ofthe inspection, it appears that you have committed a probable violation of the
-Pipeline Safety Regulations, Title 49, Code of Federal Regulations. The items inspected and
-the probable violation(s) are:
-1. 195.579 What must I do to mitigate internal corrosion?
-Inhibitors. If you use corrosion inhibitors to mitigate internal corrosion, you
41 test/fixtures/corrosion/corrosion_2.txt
@@ -1,41 +0,0 @@
-(1) Use inhibitors in sufficient quantity to protect the entire part of the pipeline
-system that the inhibitors are designed to protect;
-(2) Use coupons or other monitoring equipment to determine the effectiveness oi'
-the inhibitors in mitigating internal corrosion; and
-(3) Examine the coupons or other monitoring equipment at least twice each
-calendar year, but with intervals not exceeding 7 1/2 months.
-Internal corrosion monitoring was _discontinued on the tive hydrogen permeation monitors
-(Beta Foils) installed on Line 6B. Two manually-interrogated monitors were discontinued in
-May 2006. One remotely-interrogated monitor was discontinued in January 2006, and the
-other two remotely-interrogated monitors were discontinued in October 2007. Enbridge
-representatives stated the monitoring was discontinued due to
-"communication/instrumentation problems."
-Enbridge is in the process of implementing an alternative method of internal corrosion
-monitoring on Line 6B utilizing a technology referred to as Electrical Resistance Tomography
-(FSM-IT), however, it is not expected to be implemented on Line 6B until sometime during
-the iirst half of 2010. In the interim, Enbridge provided the following information as
-demonstration that the intemal corrosion threat is being properly managed:
-^0 a comprehensive report related to the internal corrosion mitigation and
-monitoring program for their heavy oil pipeline system
-repair sleeve installations (which require circumferential non-destructive
-6 inspection of the Line 6B Pig Sending Trap at Griffith Station (which included
-ultrasonic inspection of the trap iloor between the 5:00 and 7:00 positions)
-^0 detailed pipe examinations at in-line inspection indications
-^0 records for a weight loss coupon at the Stockbridge Pumping Station (Line 17),
-which sees only iluid ilow from Line 6B
-The information provided does not demonstrate compliance with the above regulation. Line
-6B has been ect to a batch chemical treatment program to inhibit intemal corrosion for
-several years. As required by Line 6B must have coupons or other monitoring
-equipment to determine the effectiveness of the inhibitor program, and the coupons or other
-monitoring equipment maust be examined at least twice each calendar year, at intervals not to
-exceed 7~l/2 months. PHMSA acknowledges the positive steps being taken to improve
-Enbridge's internal corrosion mitigation and monitoring program. However, the transition
-from one technology to another must be implemented in a manner that ensnres continued
-compliance with the regulations.
-Under 49 United States Code, SS 60122, you are ect to a civil penalty not to exceed
-$100,000 for each violation for each day the violation persists up to a maximum of $1,000,000
-for any related series of violations. We have reviewed the circumstances and supporting
-documents involved in this case, and have decided not to conduct additional enforcement
29 test/fixtures/corrosion/corrosion_3.txt
@@ -1,29 +0,0 @@
-Promote Cultural Diplomacy: American artists, performers and thinkers – representing our values and ideals
-– can inspire people both at home and all over the world. Through efforts like that of the United States
-Information Agency, America’s cultural leaders were deployed around the world during the Cold War as artistic
-ambassadors and helped win the war of ideas by demonstrating to the world the promise of America. Artists
-can be utilized again to help us win the war of ideas against Islamic extremism. Unfortunately, our resources
-for cultural diplomacy are at their lowest level in a decade. Barack Obama will work to reverse this trend and
-improve and expand public-private partnerships to expand cultural and arts exchanges throughout the world.
-Attract Foreign Talent: The flipside to promoting American arts and culture abroad is welcoming members of
-the foreign arts community to America. Opening America’s doors to students and professional artists provides
-the kind of two-way cultural understanding that can break down the barriers that feed hatred and fear. As
-America tightened visa restrictions after 9/11, the world’s most talented students and artists, who used to come
-here, went elsewhere. Barack Obama will streamline the visa process to return America to its rightful place as
-the world’s top destination for artists and art students.
-Provide Health Care to Artists: Finding affordable health coverage has often been one of the most vexing
-obstacles for artists and those in the creative community. Since many artists work independently or have nontraditional employment relationships, employer-based coverage is unavailable and individual policies are
-financially out of reach. Barack Obama’s plan will provide all Americans with quality, affordable health care.
-His plan includes the creation of a new public program that will allow individuals and small businesses to buy
-affordable health care similar to that available to federal employees. His plan also creates a National Health
-Insurance Exchange to reform the private insurance market and allow Americans to enroll in participating
-private plans, which would have to provide comprehensive benefits, issue every applicant a policy, and charge
-fair and stable premiums. For those who still cannot afford coverage, the government will provide a subsidy.
-His health plan will lower costs for the typical American family by up to $2,500 per year.
-Ensure Tax Fairness for Artists: Barack Obama supports the Artist-Museum Partnership Act, introduced by
-Senator Patrick Leahy (D-VT). The Act amends the Internal Revenue Code to allow artists to deduct the fair
-market value of their work, rather than just the costs of the materials, when they make charitable contributions.
-Paid for by Obama for America
18 test/fixtures/corrosion/corrosion_4.txt
@@ -1,18 +0,0 @@
-action or penalty assessment proceedings at this time. We advise you to correct the item
-identified in this letter. Failure to do so will result in Enbridge being subject to additional
-enforcement action.
-No reply to this letter is required. If you choose to reply, in your correspondence please refer
-to CPF 3-2010-5002W. Be advised that all material you submit in response to this
-enforcement action is subject to being made publicly available. If you believe that any portion
-of your responsive material qualifies for confidential treatment Linder 5 U.S.C. 552(b), along
-with the complete original document you must provide a second copy of the document with the
-portions you believe qualify for confidential treatment redacted and an explanation of Why you
-believe the redacted information qualities for confidential treatment under 5 U.S.C. 552(b).
-Ivan A. Huntoon
-Director, Central Region
-Pipeline and Hazardous Materials Safety Administration
11 test/test_helper.rb
@@ -14,4 +14,13 @@ def teardown
+ def assert_directory_contains(dir, files)
+ files_in_directory = Dir["#{dir}/*"]
+ if files.kind_of?(Array)
+ assert files_in_directory.length == files.length, "Expected directory to contain exactly #{files.length} files"
+ else
+ files = [files]
+ end
+ files.each { |f| assert files_in_directory.include?(File.join(dir, f)), "Expected directory #{dir} to contain file #{f}, but it contains #{files_in_directory.inspect}" }
+ end
9 test/unit/test_extract_images.rb
@@ -4,7 +4,7 @@ class ExtractImagesTest < Test::Unit::TestCase
def test_basic_image_extraction
Docsplit.extract_images('test/fixtures/obama_arts.pdf', :format => :gif, :size => "250x", :output => OUTPUT)
- assert Dir["#{OUTPUT}/*"] == ['test/output/obama_arts_1.gif', 'test/output/obama_arts_2.gif']
+ assert_directory_contains(OUTPUT, ['obama_arts_1.gif', 'obama_arts_2.gif'])
def test_image_formatting
@@ -36,14 +36,15 @@ def test_password_protected_extraction
def test_repeated_extraction_in_the_same_directory
Docsplit.extract_images('test/fixtures/obama_arts.pdf', :format => :gif, :size => "250x", :output => OUTPUT)
- assert Dir["#{OUTPUT}/*"] == ['test/output/obama_arts_1.gif', 'test/output/obama_arts_2.gif']
+ assert_directory_contains(OUTPUT, ['obama_arts_1.gif', 'obama_arts_2.gif'])
Docsplit.extract_images('test/fixtures/obama_arts.pdf', :format => :gif, :size => "250x", :output => OUTPUT)
- assert Dir["#{OUTPUT}/*"] == ['test/output/obama_arts_1.gif', 'test/output/obama_arts_2.gif']
+ assert_directory_contains(OUTPUT, ['obama_arts_1.gif', 'obama_arts_2.gif'])
def test_name_escaping_while_extracting_images
Docsplit.extract_images('test/fixtures/PDF file with spaces \'single\' and "double quotes".pdf', :format => :gif, :size => "250x", :output => OUTPUT)
- assert Dir["#{OUTPUT}/*"] == ['test/output/PDF file with spaces \'single\' and "double quotes"_1.gif', 'test/output/PDF file with spaces \'single\' and "double quotes"_2.gif']
+ assert_directory_contains(OUTPUT, ['PDF file with spaces \'single\' and "double quotes"_1.gif',
+ 'PDF file with spaces \'single\' and "double quotes"_1.gif'])
5 test/unit/test_extract_text.rb
@@ -30,11 +30,10 @@ def test_unicode_extraction
def test_ocr_extraction
Docsplit.extract_text('test/fixtures/corrosion.pdf', :pages => 'all', :output => OUTPUT)
- assert Dir["#{OUTPUT}/*.txt"].length == 4
4.times do |i|
file = "corrosion_#{i + 1}.txt"
- #"test/fixtures/corrosion/#{file}", "w+") {|f| f.write("#{OUTPUT}/#{file}")) }
- assert"#{OUTPUT}/#{file}") =="test/fixtures/corrosion/#{file}")
+ assert_directory_contains(OUTPUT, file)
+ assert, file)).size > 1, "Expected that file with extracted text should have reasonable size"

0 comments on commit 28fef69

Please sign in to comment.
Something went wrong with that request. Please try again.