test/test_addons.rb in heroku-api-0.1.7 vs test/test_addons.rb in heroku-api-0.1.8
- old
+ new
@@ -1,6 +1,6 @@
-require "#{File.dirname(__FILE__)}/test_helper"
+require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
class TestAddons < MiniTest::Unit::TestCase
def test_delete_addon_addon_not_found
with_app do |app_data|
@@ -24,12 +24,12 @@
end
end
def test_delete_addon
with_app do |app_data|
- heroku.post_addon(app_data['name'], 'custom_domains:basic')
- response = heroku.delete_addon(app_data['name'], 'custom_domains:basic')
+ heroku.post_addon(app_data['name'], 'deployhooks:http')
+ response = heroku.delete_addon(app_data['name'], 'deployhooks:http')
assert_equal(200, response.status)
assert_equal({
'message' => nil,
'price' => 'free',
@@ -51,24 +51,23 @@
with_app do |app_data|
response = heroku.get_addons(app_data['name'])
assert_equal(200, response.status)
assert_equal([{
- 'beta' => false,
- 'configured' => true,
- 'description' => 'Logging Basic',
- 'name' => 'logging:basic',
- 'url' => 'https://addons.heroku.com/addons/logging:basic',
- 'state' => 'disabled'
- },
- {
- 'beta' => false,
- 'configured' => true,
- 'description' => 'Shared Database 5MB',
- 'name' => 'shared-database:5mb',
- 'state' => 'public',
- 'url' => nil
+ 'attachable' => false,
+ 'beta' => false,
+ 'configured' => true,
+ 'consumes_dyno_hours' => false,
+ 'description' => 'Shared Database 5MB',
+ 'group_description' => 'Shared Database',
+ 'name' => 'shared-database:5mb',
+ 'plan_description' => '5mb',
+ 'price' => { 'cents' => 0, 'unit' => 'month' },
+ 'slug' => '5mb',
+ 'state' => 'public',
+ 'terms_of_service' => false,
+ 'url' => nil
}], response.body)
end
end
def test_get_addons_with_app_app_not_found
@@ -77,11 +76,11 @@
end
end
def test_post_addon
with_app do |app_data|
- response = heroku.post_addon(app_data['name'], 'custom_domains:basic')
+ response = heroku.post_addon(app_data['name'], 'deployhooks:http')
assert_equal(200, response.status)
assert_equal({
'message' => nil,
'price' => 'free',
@@ -90,16 +89,16 @@
end
end
def test_post_addon_with_config
with_app do |app_data|
- response = heroku.post_addon(app_data['name'], 'heroku-postgresql:ronin', {"superuser"=>"SUPERSECRET"})
+ response = heroku.post_addon(app_data['name'], 'deployhooks:http', {"url"=>"http://example.com"})
assert_equal(200, response.status)
assert_equal({
'message' => nil,
- 'price' => '$200/mo',
+ 'price' => 'free',
'status' => 'Installed'
}, response.body)
end
end
@@ -121,11 +120,11 @@
end
end
def test_post_addon_addon_not_found
with_app do |app_data|
- assert_raises(Heroku::API::Errors::RequestFailed) do
+ assert_raises(Heroku::API::Errors::NotFound) do
heroku.post_addon(app_data['name'], random_name)
end
end
end
@@ -135,15 +134,16 @@
end
end
def test_put_addon
with_app do |app_data|
- response = heroku.put_addon(app_data['name'], 'logging:expanded')
+ response = heroku.post_addon(app_data['name'], 'pgbackups:basic')
+ response = heroku.put_addon(app_data['name'], 'pgbackups:plus')
assert_equal(200, response.status)
assert_equal({
- 'message' => nil,
+ 'message' => 'Plan upgraded',
'price' => 'free',
'status' => 'Updated'
}, response.body)
end
end
@@ -157,10 +157,10 @@
end
end
def test_put_addon_addon_not_found
with_app do |app_data|
- assert_raises(Heroku::API::Errors::RequestFailed) do
+ assert_raises(Heroku::API::Errors::NotFound) do
heroku.put_addon(app_data['name'], random_name)
end
end
end