Permalink
Browse files

update openstates fixtures

  • Loading branch information...
1 parent 2cb2a37 commit 61b0ea2213d032f7f6b017f71175d578ee9d1e08 @jpmckinney jpmckinney committed Nov 16, 2012
View
@@ -73,3 +73,26 @@ if defined?(RSpec)
t.rcov_opts = ['--exclude', 'spec,Library']
end
end
+
+desc "Generate RSpec fixtures"
+task :generate_rspec_fixtures do |t,args|
+ if ENV['APIKEY'].nil?
+ abort "Usage: APIKEY=12345... rake generate_rspec_fixtures"
+ end
+
+ { "/legislators/XXL123456/" => '401.response',
+ "/metadata/ca/?apikey=#{ENV['APIKEY']}" => 'state.response',
+ "/bills/ca/20092010/lower/AB%20667/?apikey=#{ENV['APIKEY']}" => 'bill.response',
+ "/bills/?apikey=#{ENV['APIKEY']}&q=cooperatives" => 'bill_find.response',
+ "/bills/?apikey=#{ENV['APIKEY']}&updated_since=2012-11-01&state=tx" => 'bill_query.response',
+ "/legislators/CAL000088/?apikey=#{ENV['APIKEY']}" => 'legislator_find.response',
+ "/legislators/CAL999999/?apikey=#{ENV['APIKEY']}" => '404.response',
+ "/legislators/?apikey=#{ENV['APIKEY']}&state=ca" => 'legislator_query.response',
+ "/legislators/?apikey=#{ENV['APIKEY']}&state=zz" => '404.response',
+ "/committees/MDC000012/?apikey=#{ENV['APIKEY']}" => 'committee_find.response',
+ "/committees/?apikey=#{ENV['APIKEY']}&state=md&chamber=upper" => 'committee_query.response',
+ }.each do |path,basename|
+ filepath = File.expand_path("../spec/fixtures/open_states/#{basename}", __FILE__)
+ `curl -s -i -o #{filepath} "http://openstates.org/api/v1#{path}"`
+ end
+end
@@ -1,10 +1,10 @@
-HTTP/1.1 401 UNAUTHORIZED
-Server: nginx/0.9.6
-Date: Thu, 21 Apr 2011 22:02:36 GMT
-Content-Type: text/html; charset=utf-8
-Transfer-Encoding: chunked
-Connection: close
-Vary: Authorization
-
+HTTP/1.1 401 UNAUTHORIZED
+Server: nginx/1.2.1
+Date: Fri, 16 Nov 2012 23:40:31 GMT
+Content-Type: text/html; charset=utf-8
+Transfer-Encoding: chunked
+Connection: keep-alive
+Vary: Authorization
+
Authorization Required:
-obtain a key at http://services.sunlightlabs.com/accounts/register/
+obtain a key at http://services.sunlightlabs.com/accounts/register/
@@ -1,9 +1,9 @@
-HTTP/1.1 404 NOT FOUND
-Server: nginx/0.9.6
-Date: Thu, 21 Apr 2011 21:34:05 GMT
-Content-Type: text/html; charset=utf-8
-Transfer-Encoding: chunked
-Connection: close
-
-404 not found
-
+HTTP/1.1 200 OK
+Server: nginx/1.2.1
+Date: Fri, 16 Nov 2012 23:40:35 GMT
+Content-Type: application/json; charset=utf-8
+Transfer-Encoding: chunked
+Connection: keep-alive
+Vary: Authorization
+
+[]
@@ -1,6 +0,0 @@
-HTTP/1.1 410 GONE
-Server: nginx/0.6.35
-Date: Tue, 15 Jun 2010 22:34:56 GMT
-Content-Type: text/plain
-Connection: close
-Vary: Authorization

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 61b0ea2

Please sign in to comment.