heroku-api 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_addons.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestAddons < MiniTest::Unit::TestCase
4
4
 
@@ -26,8 +26,8 @@ class TestAddons < MiniTest::Unit::TestCase
26
26
 
27
27
  def test_delete_addon
28
28
  with_app do |app_data|
29
- heroku.post_addon(app_data['name'], 'custom_domains:basic')
30
- response = heroku.delete_addon(app_data['name'], 'custom_domains:basic')
29
+ heroku.post_addon(app_data['name'], 'deployhooks:http')
30
+ response = heroku.delete_addon(app_data['name'], 'deployhooks:http')
31
31
 
32
32
  assert_equal(200, response.status)
33
33
  assert_equal({
@@ -53,20 +53,19 @@ class TestAddons < MiniTest::Unit::TestCase
53
53
 
54
54
  assert_equal(200, response.status)
55
55
  assert_equal([{
56
- 'beta' => false,
57
- 'configured' => true,
58
- 'description' => 'Logging Basic',
59
- 'name' => 'logging:basic',
60
- 'url' => 'https://addons.heroku.com/addons/logging:basic',
61
- 'state' => 'disabled'
62
- },
63
- {
64
- 'beta' => false,
65
- 'configured' => true,
66
- 'description' => 'Shared Database 5MB',
67
- 'name' => 'shared-database:5mb',
68
- 'state' => 'public',
69
- 'url' => nil
56
+ 'attachable' => false,
57
+ 'beta' => false,
58
+ 'configured' => true,
59
+ 'consumes_dyno_hours' => false,
60
+ 'description' => 'Shared Database 5MB',
61
+ 'group_description' => 'Shared Database',
62
+ 'name' => 'shared-database:5mb',
63
+ 'plan_description' => '5mb',
64
+ 'price' => { 'cents' => 0, 'unit' => 'month' },
65
+ 'slug' => '5mb',
66
+ 'state' => 'public',
67
+ 'terms_of_service' => false,
68
+ 'url' => nil
70
69
  }], response.body)
71
70
  end
72
71
  end
@@ -79,7 +78,7 @@ class TestAddons < MiniTest::Unit::TestCase
79
78
 
80
79
  def test_post_addon
81
80
  with_app do |app_data|
82
- response = heroku.post_addon(app_data['name'], 'custom_domains:basic')
81
+ response = heroku.post_addon(app_data['name'], 'deployhooks:http')
83
82
 
84
83
  assert_equal(200, response.status)
85
84
  assert_equal({
@@ -92,12 +91,12 @@ class TestAddons < MiniTest::Unit::TestCase
92
91
 
93
92
  def test_post_addon_with_config
94
93
  with_app do |app_data|
95
- response = heroku.post_addon(app_data['name'], 'heroku-postgresql:ronin', {"superuser"=>"SUPERSECRET"})
94
+ response = heroku.post_addon(app_data['name'], 'deployhooks:http', {"url"=>"http://example.com"})
96
95
 
97
96
  assert_equal(200, response.status)
98
97
  assert_equal({
99
98
  'message' => nil,
100
- 'price' => '$200/mo',
99
+ 'price' => 'free',
101
100
  'status' => 'Installed'
102
101
  }, response.body)
103
102
  end
@@ -123,7 +122,7 @@ class TestAddons < MiniTest::Unit::TestCase
123
122
 
124
123
  def test_post_addon_addon_not_found
125
124
  with_app do |app_data|
126
- assert_raises(Heroku::API::Errors::RequestFailed) do
125
+ assert_raises(Heroku::API::Errors::NotFound) do
127
126
  heroku.post_addon(app_data['name'], random_name)
128
127
  end
129
128
  end
@@ -137,11 +136,12 @@ class TestAddons < MiniTest::Unit::TestCase
137
136
 
138
137
  def test_put_addon
139
138
  with_app do |app_data|
140
- response = heroku.put_addon(app_data['name'], 'logging:expanded')
139
+ response = heroku.post_addon(app_data['name'], 'pgbackups:basic')
140
+ response = heroku.put_addon(app_data['name'], 'pgbackups:plus')
141
141
 
142
142
  assert_equal(200, response.status)
143
143
  assert_equal({
144
- 'message' => nil,
144
+ 'message' => 'Plan upgraded',
145
145
  'price' => 'free',
146
146
  'status' => 'Updated'
147
147
  }, response.body)
@@ -159,7 +159,7 @@ class TestAddons < MiniTest::Unit::TestCase
159
159
 
160
160
  def test_put_addon_addon_not_found
161
161
  with_app do |app_data|
162
- assert_raises(Heroku::API::Errors::RequestFailed) do
162
+ assert_raises(Heroku::API::Errors::NotFound) do
163
163
  heroku.put_addon(app_data['name'], random_name)
164
164
  end
165
165
  end
data/test/test_apps.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
4
 
@@ -98,14 +98,14 @@ class TestApps < MiniTest::Unit::TestCase
98
98
  def test_put_app_with_transfer_owner_non_collaborator
99
99
  with_app do |app_data|
100
100
  assert_raises(Heroku::API::Errors::RequestFailed) do
101
- heroku.put_app(app_data['name'], 'transfer_owner' => random_email_address)
101
+ heroku.put_app(app_data['name'], 'transfer_owner' => 'wesley@heroku.com')
102
102
  end
103
103
  end
104
104
  end
105
105
 
106
106
  def test_put_app_with_transfer_owner
107
107
  with_app do |app_data|
108
- email_address = 'wesley+heroku.rb@heroku.com'
108
+ email_address = 'wesley@heroku.com'
109
109
  heroku.post_collaborator(app_data['name'], email_address)
110
110
  response = heroku.put_app(app_data['name'], 'transfer_owner' => email_address)
111
111
 
@@ -1,10 +1,10 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestCollaborators < MiniTest::Unit::TestCase
4
4
 
5
5
  def test_delete_collaborator
6
6
  with_app do |app_data|
7
- email_address = 'wesley+heroku.rb@heroku.com'
7
+ email_address = 'wesley@heroku.com'
8
8
  heroku.post_collaborator(app_data['name'], email_address)
9
9
 
10
10
  response = heroku.delete_collaborator(app_data['name'], email_address)
@@ -37,7 +37,7 @@ class TestCollaborators < MiniTest::Unit::TestCase
37
37
 
38
38
  assert_equal(200, response.status)
39
39
  assert_equal(
40
- [{'access' => 'edit', 'email' => app_data['owner_email']}],
40
+ [{'access' => 'edit', 'email' => app_data['owner_email'], 'name' => nil}],
41
41
  response.body
42
42
  )
43
43
  end
@@ -51,7 +51,7 @@ class TestCollaborators < MiniTest::Unit::TestCase
51
51
 
52
52
  def test_post_collaborator
53
53
  with_app do |app_data|
54
- email_address = 'wesley+heroku.rb@heroku.com'
54
+ email_address = 'wesley@heroku.com'
55
55
  response = heroku.post_collaborator(app_data['name'], email_address)
56
56
 
57
57
  assert_equal(200, response.status)
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestConfigVars < MiniTest::Unit::TestCase
4
4
 
data/test/test_domains.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestDomains < MiniTest::Unit::TestCase
4
4
 
@@ -10,9 +10,9 @@ class TestDomains < MiniTest::Unit::TestCase
10
10
 
11
11
  def test_delete_domain
12
12
  with_app do |app_data|
13
- heroku.post_addon(app_data['name'], 'custom_domains:basic')
14
- heroku.post_domain(app_data['name'], 'example.com')
15
- response = heroku.delete_domain(app_data['name'], 'example.com')
13
+ domain = random_domain
14
+ heroku.post_domain(app_data['name'], domain)
15
+ response = heroku.delete_domain(app_data['name'], domain)
16
16
 
17
17
  assert_equal(200, response.status)
18
18
  assert_equal({}, response.body)
@@ -21,8 +21,7 @@ class TestDomains < MiniTest::Unit::TestCase
21
21
 
22
22
  def test_delete_domains
23
23
  with_app do |app_data|
24
- heroku.post_addon(app_data['name'], 'custom_domains:basic')
25
- heroku.post_domain(app_data['name'], 'example.com')
24
+ heroku.post_domain(app_data['name'], random_domain)
26
25
  response = heroku.delete_domains(app_data['name'])
27
26
 
28
27
  assert_equal(200, response.status)
@@ -47,21 +46,13 @@ class TestDomains < MiniTest::Unit::TestCase
47
46
 
48
47
  def test_post_domain
49
48
  with_app do |app_data|
50
- heroku.post_addon(app_data['name'], 'custom_domains:basic')
51
- response = heroku.post_domain(app_data['name'], 'example.com')
49
+ domain = random_domain
50
+ response = heroku.post_domain(app_data['name'], domain)
52
51
 
53
52
  assert_equal(201, response.status)
54
- assert_equal({'domain' => 'example.com'}, response.body)
53
+ assert_equal({'domain' => domain}, response.body)
55
54
 
56
- heroku.delete_domain(app_data['name'], 'example.com')
57
- end
58
- end
59
-
60
- def test_post_domain_addon_not_installed
61
- with_app do |app_data|
62
- assert_raises(Heroku::API::Errors::RequestFailed) do
63
- heroku.post_domain(app_data['name'], 'example.com')
64
- end
55
+ heroku.delete_domain(app_data['name'], domain)
65
56
  end
66
57
  end
67
58
 
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/../lib/heroku/api"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../lib/heroku/api")
2
2
 
3
3
  require 'rubygems'
4
4
  gem 'minitest' # ensure we are using the gem version
@@ -12,6 +12,10 @@ def heroku
12
12
  Heroku::API.new(:mock => MOCK)
13
13
  end
14
14
 
15
+ def random_domain
16
+ "#{random_name}.com"
17
+ end
18
+
15
19
  def random_name
16
20
  "heroku-rb-#{SecureRandom.hex(10)}"
17
21
  end
data/test/test_keys.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestKeys < MiniTest::Unit::TestCase
4
4
  KEY_DATA = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz29znMi/UJX/nvkRSO5FFugKhU9DkkI53E0vXUnP8zeLFxMgyUqmXryPVjWtGzz2LRWqjm14SbqHAmM44pGHVfBIp6wCKBWSUYGv/FxOulwYgtWzz4moxWLZrFyWWgJAnehcVUifHNgzKwT2ovWm2ns52681Z8yFK3K8/uLStDjLIaPePEOaxaTvgIxZNsfyEoXoHcyTPwdR1GtQuDTuDYqYmjmPCoKybYnXrTQ1QFuQxDneBkswQYSl0H2aLf3uBK4F01hr+azXQuSe39eSV4I/TqzmNJlanpILT9Jz3/J1i4r6brpF3AxLnFnb9ufIbzQAIa/VZIulfrZkcBsUl david@carbon.local"
data/test/test_login.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestLogin < MiniTest::Unit::TestCase
4
4
 
data/test/test_logs.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestLogs < MiniTest::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestProcesses < MiniTest::Unit::TestCase
4
4
 
@@ -71,7 +71,7 @@ class TestProcesses < MiniTest::Unit::TestCase
71
71
  # depending on timing it will be one of these two states
72
72
  assert_includes(['created', 'starting'], ps['state'])
73
73
  # transitioned_at
74
- assert_equal('Ps', ps['type'])
74
+ assert_equal(nil, ps['type'])
75
75
  # upid
76
76
  end
77
77
  end
@@ -1,10 +1,9 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestReleases < MiniTest::Unit::TestCase
4
4
 
5
5
  def test_get_releases
6
6
  with_app do |app_data|
7
- heroku.post_addon(app_data['name'], 'releases:basic')
8
7
  response = heroku.get_releases(app_data['name'])
9
8
 
10
9
  assert_equal(200, response.status)
@@ -18,17 +17,8 @@ class TestReleases < MiniTest::Unit::TestCase
18
17
  end
19
18
  end
20
19
 
21
- def test_get_releases_addon_not_installed
22
- with_app do |app_data|
23
- assert_raises(Heroku::API::Errors::RequestFailed) do
24
- heroku.get_releases(app_data['name'])
25
- end
26
- end
27
- end
28
-
29
20
  def test_get_release
30
21
  with_app do |app_data|
31
- heroku.post_addon(app_data['name'], 'releases:basic')
32
22
  current = heroku.get_releases(app_data['name']).body.last['name']
33
23
  response = heroku.get_release(app_data['name'], current)
34
24
 
@@ -39,7 +29,6 @@ class TestReleases < MiniTest::Unit::TestCase
39
29
 
40
30
  def test_get_release_current
41
31
  with_app do |app_data|
42
- heroku.post_addon(app_data['name'], 'releases:basic')
43
32
  response = heroku.get_release(app_data['name'], 'current')
44
33
 
45
34
  assert_equal(200, response.status)
@@ -53,14 +42,6 @@ class TestReleases < MiniTest::Unit::TestCase
53
42
  end
54
43
  end
55
44
 
56
- def test_get_release_addon_not_installed
57
- with_app do |app_data|
58
- assert_raises(Heroku::API::Errors::RequestFailed) do
59
- heroku.get_release(app_data['name'], 'v2')
60
- end
61
- end
62
- end
63
-
64
45
  def test_get_release_release_not_found
65
46
  assert_raises(Heroku::API::Errors::NotFound) do
66
47
  heroku.get_release(random_name, 'v0')
@@ -69,7 +50,6 @@ class TestReleases < MiniTest::Unit::TestCase
69
50
 
70
51
  def test_post_release
71
52
  with_app do |app_data|
72
- heroku.post_addon(app_data['name'], 'releases:basic')
73
53
  current = heroku.get_releases(app_data['name']).body.last['name']
74
54
  response = heroku.post_release(app_data['name'], current)
75
55
 
@@ -84,14 +64,6 @@ class TestReleases < MiniTest::Unit::TestCase
84
64
  end
85
65
  end
86
66
 
87
- def test_post_release_addon_not_installed
88
- with_app do |app_data|
89
- assert_raises(Heroku::API::Errors::RequestFailed) do
90
- heroku.post_release(app_data['name'], 'v3')
91
- end
92
- end
93
- end
94
-
95
67
  def test_post_release_release_not_found
96
68
  assert_raises(Heroku::API::Errors::NotFound) do
97
69
  heroku.post_release(random_name, 'v0')
data/test/test_stacks.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestStacks < MiniTest::Unit::TestCase
4
4
 
data/test/test_user.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/test_helper"
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestUser < MiniTest::Unit::TestCase
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-15 00:00:00.000000000 Z
12
+ date: 2012-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
16
- requirement: &70282807340220 !ruby/object:Gem::Requirement
16
+ requirement: &70208858474840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.13.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70282807340220
24
+ version_requirements: *70208858474840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70282807339460 !ruby/object:Gem::Requirement
27
+ requirement: &70208858474420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70282807339460
35
+ version_requirements: *70208858474420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70282807338560 !ruby/object:Gem::Requirement
38
+ requirement: &70208858473940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70282807338560
46
+ version_requirements: *70208858473940
47
47
  description: Ruby Client for the Heroku API
48
48
  email:
49
49
  - wesley@heroku.com
@@ -115,12 +115,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
+ segments:
119
+ - 0
120
+ hash: 1066627080143481196
118
121
  required_rubygems_version: !ruby/object:Gem::Requirement
119
122
  none: false
120
123
  requirements:
121
124
  - - ! '>='
122
125
  - !ruby/object:Gem::Version
123
126
  version: '0'
127
+ segments:
128
+ - 0
129
+ hash: 1066627080143481196
124
130
  requirements: []
125
131
  rubyforge_project:
126
132
  rubygems_version: 1.8.15