Permalink
Browse files

Merge pull request #382 from pythonpackages/master

Add PythonPackages service for pythonpackages.com
  • Loading branch information...
2 parents 2b4e7aa + c300318 commit 576aa0b387c514e209ac75d4f75cc33d1627f8a4 @technoweenie technoweenie committed Aug 9, 2012
Showing with 35 additions and 0 deletions.
  1. +6 −0 docs/pythonpackages
  2. +5 −0 services/pythonpackages.rb
  3. +24 −0 test/pythonpackages_test.rb
View
@@ -0,0 +1,6 @@
+
+PythonPackages
+==============
+
+Automatically release Python packages from GitHub to the Python Package Index ('http://pypi.python.org'). For more information, please see: ('http://docs.pythonpackages.com/en/latest/github-service.html').
+
@@ -0,0 +1,5 @@
+class Service::PythonPackages < Service
+ def receive_push
+ http_post "https://pythonpackages.com/github", :payload => JSON.generate(payload)
+ end
+end
@@ -0,0 +1,24 @@
+require File.expand_path('../helper', __FILE__)
+
+class PythonPackagesTest < Service::TestCase
+ def setup
+ @stubs = Faraday::Adapter::Test::Stubs.new
+ end
+
+ def test_push
+ @stubs.post "/github" do |env|
+ assert_equal 'pythonpackages.com', env[:url].host
+ data = Rack::Utils.parse_query(env[:body])
+ assert_equal 1, JSON.parse(data['payload'])['a']
+ [200, {}, '']
+ end
+
+ svc = service({}, :a => 1)
+ svc.receive_push
+ end
+
+ def service(*args)
+ super Service::PythonPackages, *args
+ end
+end
+

0 comments on commit 576aa0b

Please sign in to comment.