scalingo 3.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +110 -0
- data/LICENSE.txt +22 -0
- data/README.md +147 -0
- data/Rakefile +6 -0
- data/bin/console +12 -0
- data/bin/setup +8 -0
- data/lib/scalingo.rb +2 -0
- data/lib/scalingo/api/client.rb +79 -0
- data/lib/scalingo/api/endpoint.rb +23 -0
- data/lib/scalingo/api/response.rb +71 -0
- data/lib/scalingo/auth.rb +21 -0
- data/lib/scalingo/auth/keys.rb +56 -0
- data/lib/scalingo/auth/scm_integrations.rb +57 -0
- data/lib/scalingo/auth/tokens.rb +78 -0
- data/lib/scalingo/auth/two_factor_auth.rb +61 -0
- data/lib/scalingo/auth/user.rb +31 -0
- data/lib/scalingo/bearer_token.rb +20 -0
- data/lib/scalingo/client.rb +105 -0
- data/lib/scalingo/config.rb +38 -0
- data/lib/scalingo/error/expired_token.rb +6 -0
- data/lib/scalingo/error/unauthenticated.rb +6 -0
- data/lib/scalingo/errors.rb +2 -0
- data/lib/scalingo/regional.rb +35 -0
- data/lib/scalingo/regional/addons.rb +109 -0
- data/lib/scalingo/regional/apps.rb +109 -0
- data/lib/scalingo/regional/collaborators.rb +57 -0
- data/lib/scalingo/regional/containers.rb +57 -0
- data/lib/scalingo/regional/deployments.rb +44 -0
- data/lib/scalingo/regional/domains.rb +70 -0
- data/lib/scalingo/regional/environment.rb +83 -0
- data/lib/scalingo/regional/events.rb +55 -0
- data/lib/scalingo/regional/logs.rb +38 -0
- data/lib/scalingo/regional/metrics.rb +41 -0
- data/lib/scalingo/regional/notifiers.rb +96 -0
- data/lib/scalingo/regional/operations.rb +18 -0
- data/lib/scalingo/regional/scm_repo_links.rb +109 -0
- data/lib/scalingo/version.rb +3 -0
- data/samples/auth/keys/_meta.json +13 -0
- data/samples/auth/keys/all-200.json +62 -0
- data/samples/auth/keys/create-201.json +67 -0
- data/samples/auth/keys/create-422.json +34 -0
- data/samples/auth/keys/destroy-204.json +19 -0
- data/samples/auth/keys/destroy-404.json +19 -0
- data/samples/auth/keys/show-200.json +60 -0
- data/samples/auth/keys/show-404.json +19 -0
- data/samples/auth/scm_integrations/_meta.json +14 -0
- data/samples/auth/scm_integrations/all-200.json +41 -0
- data/samples/auth/scm_integrations/create-201.json +41 -0
- data/samples/auth/scm_integrations/create-422.json +36 -0
- data/samples/auth/scm_integrations/destroy-204.json +15 -0
- data/samples/auth/scm_integrations/destroy-404.json +23 -0
- data/samples/auth/scm_integrations/show-200.json +34 -0
- data/samples/auth/scm_integrations/show-404.json +23 -0
- data/samples/auth/tokens/_meta.json +13 -0
- data/samples/auth/tokens/all-200.json +32 -0
- data/samples/auth/tokens/create-201.json +37 -0
- data/samples/auth/tokens/destroy-204.json +19 -0
- data/samples/auth/tokens/destroy-404.json +19 -0
- data/samples/auth/tokens/exchange-200.json +25 -0
- data/samples/auth/tokens/exchange-401.json +24 -0
- data/samples/auth/tokens/renew-200.json +32 -0
- data/samples/auth/tokens/renew-404.json +20 -0
- data/samples/auth/two_factor_auth/_meta.json +10 -0
- data/samples/auth/two_factor_auth/disable-not-initiated.json +23 -0
- data/samples/auth/two_factor_auth/disable-success.json +29 -0
- data/samples/auth/two_factor_auth/initiate-already-enabled.json +29 -0
- data/samples/auth/two_factor_auth/initiate-success.json +36 -0
- data/samples/auth/two_factor_auth/initiate-wrong-provider.json +29 -0
- data/samples/auth/two_factor_auth/status.json +29 -0
- data/samples/auth/two_factor_auth/validate-not-initiated.json +29 -0
- data/samples/auth/two_factor_auth/validate-success.json +49 -0
- data/samples/auth/two_factor_auth/validate-wrong.json +29 -0
- data/samples/auth/user/_meta.json +10 -0
- data/samples/auth/user/self.json +54 -0
- data/samples/auth/user/update-200.json +59 -0
- data/samples/auth/user/update-422.json +33 -0
- data/samples/regional/addons/_meta.json +22 -0
- data/samples/regional/addons/categories-guest.json +36 -0
- data/samples/regional/addons/categories-logged.json +37 -0
- data/samples/regional/addons/destroy-204.json +19 -0
- data/samples/regional/addons/destroy-404.json +24 -0
- data/samples/regional/addons/find-200.json +48 -0
- data/samples/regional/addons/find-404.json +24 -0
- data/samples/regional/addons/for-200.json +50 -0
- data/samples/regional/addons/providers-guest.json +588 -0
- data/samples/regional/addons/providers-logged.json +705 -0
- data/samples/regional/addons/provision-201.json +58 -0
- data/samples/regional/addons/provision-400.json +29 -0
- data/samples/regional/addons/sso-200.json +49 -0
- data/samples/regional/addons/sso-404.json +24 -0
- data/samples/regional/addons/update-200.json +58 -0
- data/samples/regional/addons/update-404.json +30 -0
- data/samples/regional/apps/_meta.json +52 -0
- data/samples/regional/apps/all.json +99 -0
- data/samples/regional/apps/create-201.json +66 -0
- data/samples/regional/apps/create-422.json +34 -0
- data/samples/regional/apps/destroy-204.json +19 -0
- data/samples/regional/apps/destroy-404.json +24 -0
- data/samples/regional/apps/destroy-422.json +27 -0
- data/samples/regional/apps/find-200.json +60 -0
- data/samples/regional/apps/find-404.json +24 -0
- data/samples/regional/apps/logs_url.json +62 -0
- data/samples/regional/apps/rename-200.json +65 -0
- data/samples/regional/apps/rename-404.json +29 -0
- data/samples/regional/apps/rename-422.json +33 -0
- data/samples/regional/apps/transfer-200.json +65 -0
- data/samples/regional/apps/transfer-404.json +27 -0
- data/samples/regional/apps/transfer-422.json +34 -0
- data/samples/regional/apps/update-200.json +66 -0
- data/samples/regional/apps/update-stack-404.json +30 -0
- data/samples/regional/collaborators/_meta.json +17 -0
- data/samples/regional/collaborators/accept-200.json +60 -0
- data/samples/regional/collaborators/accept-400.json +24 -0
- data/samples/regional/collaborators/accept-404.json +24 -0
- data/samples/regional/collaborators/destroy-204.json +19 -0
- data/samples/regional/collaborators/destroy-404.json +24 -0
- data/samples/regional/collaborators/for-200.json +34 -0
- data/samples/regional/collaborators/invite-201.json +37 -0
- data/samples/regional/collaborators/invite-422.json +34 -0
- data/samples/regional/containers/_meta.json +25 -0
- data/samples/regional/containers/for-200.json +39 -0
- data/samples/regional/containers/restart-202.json +28 -0
- data/samples/regional/containers/restart-422.json +33 -0
- data/samples/regional/containers/scale-202.json +48 -0
- data/samples/regional/containers/scale-422.json +36 -0
- data/samples/regional/containers/sizes-guest.json +115 -0
- data/samples/regional/containers/sizes-logged.json +116 -0
- data/samples/regional/deployments/_meta.json +8 -0
- data/samples/regional/deployments/find-200.json +45 -0
- data/samples/regional/deployments/find-404.json +24 -0
- data/samples/regional/deployments/for-with-paging.json +35 -0
- data/samples/regional/deployments/for-without-pages.json +56 -0
- data/samples/regional/deployments/logs-200.json +22 -0
- data/samples/regional/deployments/logs-404.json +24 -0
- data/samples/regional/domains/_meta.json +21 -0
- data/samples/regional/domains/create-201.json +44 -0
- data/samples/regional/domains/create-422.json +33 -0
- data/samples/regional/domains/destroy-204.json +19 -0
- data/samples/regional/domains/destroy-404.json +24 -0
- data/samples/regional/domains/find-200.json +38 -0
- data/samples/regional/domains/find-404.json +24 -0
- data/samples/regional/domains/for-200.json +40 -0
- data/samples/regional/domains/update-200.json +44 -0
- data/samples/regional/domains/update-404.json +30 -0
- data/samples/regional/domains/update-422.json +33 -0
- data/samples/regional/environment/_meta.json +43 -0
- data/samples/regional/environment/bulk-destroy-204.json +19 -0
- data/samples/regional/environment/bulk-update-200.json +70 -0
- data/samples/regional/environment/create-201.json +36 -0
- data/samples/regional/environment/create-422.json +37 -0
- data/samples/regional/environment/destroy-204.json +19 -0
- data/samples/regional/environment/destroy-404.json +24 -0
- data/samples/regional/environment/for-200.json +31 -0
- data/samples/regional/environment/update-200.json +35 -0
- data/samples/regional/environment/update-404.json +30 -0
- data/samples/regional/events/_meta.json +3 -0
- data/samples/regional/events/all-200.json +619 -0
- data/samples/regional/events/categories-guest.json +66 -0
- data/samples/regional/events/categories-logged.json +67 -0
- data/samples/regional/events/for-200.json +404 -0
- data/samples/regional/events/types-guest.json +288 -0
- data/samples/regional/events/types-logged.json +289 -0
- data/samples/regional/logs/_meta.json +11 -0
- data/samples/regional/logs/archives-200.json +28 -0
- data/samples/regional/logs/get-guest-200.json +18 -0
- data/samples/regional/logs/get-logged-200.json +19 -0
- data/samples/regional/logs/get-with-limit-200.json +18 -0
- data/samples/regional/metrics/_meta.json +15 -0
- data/samples/regional/metrics/for-invalid-400.json +23 -0
- data/samples/regional/metrics/for-valid-cpu-200.json +747 -0
- data/samples/regional/metrics/for-valid-router-404.json +23 -0
- data/samples/regional/metrics/types-guest.json +66 -0
- data/samples/regional/metrics/types-logged.json +67 -0
- data/samples/regional/notifiers/_meta.json +23 -0
- data/samples/regional/notifiers/create-201.json +55 -0
- data/samples/regional/notifiers/create-404.json +30 -0
- data/samples/regional/notifiers/create-422.json +36 -0
- data/samples/regional/notifiers/destroy-204.json +19 -0
- data/samples/regional/notifiers/destroy-404.json +24 -0
- data/samples/regional/notifiers/find-200.json +47 -0
- data/samples/regional/notifiers/find-404.json +24 -0
- data/samples/regional/notifiers/for-200.json +49 -0
- data/samples/regional/notifiers/platforms-guest.json +184 -0
- data/samples/regional/notifiers/platforms-logged.json +185 -0
- data/samples/regional/notifiers/test-200.json +22 -0
- data/samples/regional/notifiers/test-404.json +25 -0
- data/samples/regional/notifiers/update-200.json +53 -0
- data/samples/regional/operations/_meta.json +5 -0
- data/samples/regional/operations/find-200.json +31 -0
- data/samples/regional/operations/find-404.json +24 -0
- data/samples/regional/scm_repo_links/_meta.json +22 -0
- data/samples/regional/scm_repo_links/create-201.json +54 -0
- data/samples/regional/scm_repo_links/destroy-204.json +15 -0
- data/samples/regional/scm_repo_links/manual-deploy-200.json +32 -0
- data/samples/regional/scm_repo_links/show-200.json +43 -0
- data/samples/regional/scm_repo_links/update-200.json +50 -0
- data/scalingo.gemspec +51 -0
- data/spec/scalingo/auth/keys_spec.rb +58 -0
- data/spec/scalingo/auth/scm_integrations_spec.rb +58 -0
- data/spec/scalingo/auth/tokens_spec.rb +74 -0
- data/spec/scalingo/auth/two_factor_auth_spec.rb +69 -0
- data/spec/scalingo/auth/user_spec.rb +25 -0
- data/spec/scalingo/regional/addons_spec.rb +133 -0
- data/spec/scalingo/regional/apps_spec.rb +137 -0
- data/spec/scalingo/regional/collaborators_spec.rb +69 -0
- data/spec/scalingo/regional/containers_spec.rb +67 -0
- data/spec/scalingo/regional/deployments_spec.rb +45 -0
- data/spec/scalingo/regional/domains_spec.rb +84 -0
- data/spec/scalingo/regional/environment_spec.rb +77 -0
- data/spec/scalingo/regional/events_spec.rb +65 -0
- data/spec/scalingo/regional/logs_spec.rb +39 -0
- data/spec/scalingo/regional/metrics_spec.rb +46 -0
- data/spec/scalingo/regional/notifiers_spec.rb +113 -0
- data/spec/scalingo/regional/operations_spec.rb +19 -0
- data/spec/scalingo/regional/scm_repo_links_spec.rb +48 -0
- metadata +488 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Auth::Tokens do
|
4
|
+
describe_method "exchange" do
|
5
|
+
subject { auth_guest.tokens }
|
6
|
+
|
7
|
+
context "with a valid token" do
|
8
|
+
let(:arguments) { meta[:exchange][:valid] }
|
9
|
+
let(:stub_pattern) { "exchange-200" }
|
10
|
+
|
11
|
+
it "should be successful" do
|
12
|
+
expect(response).to be_successful
|
13
|
+
expect(response.data[:token]).to be_present
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with an invalid token" do
|
18
|
+
let(:arguments) { meta[:exchange][:invalid] }
|
19
|
+
let(:stub_pattern) { "exchange-401" }
|
20
|
+
|
21
|
+
it "should be rejected with an valid token" do
|
22
|
+
expect(response.status).to eq 401
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe_method "all" do
|
28
|
+
let(:stub_pattern) { "all-200" }
|
29
|
+
|
30
|
+
it_behaves_like "a collection response"
|
31
|
+
it_behaves_like "a non-paginated collection"
|
32
|
+
end
|
33
|
+
|
34
|
+
describe_method "create" do
|
35
|
+
context "success" do
|
36
|
+
let(:arguments) { meta[:create][:valid] }
|
37
|
+
let(:stub_pattern) { "create-201" }
|
38
|
+
|
39
|
+
it_behaves_like "a singular object response", 201
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe_method "renew" do
|
44
|
+
context "success" do
|
45
|
+
let(:arguments) { meta[:id] }
|
46
|
+
let(:stub_pattern) { "renew-200" }
|
47
|
+
|
48
|
+
it_behaves_like "a singular object response"
|
49
|
+
end
|
50
|
+
|
51
|
+
context "not found" do
|
52
|
+
let(:arguments) { meta[:not_found_id] }
|
53
|
+
let(:stub_pattern) { "renew-404" }
|
54
|
+
|
55
|
+
it_behaves_like "a not found response"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe_method "destroy" do
|
60
|
+
context "success" do
|
61
|
+
let(:arguments) { meta[:id] }
|
62
|
+
let(:stub_pattern) { "destroy-204" }
|
63
|
+
|
64
|
+
it_behaves_like "an empty response"
|
65
|
+
end
|
66
|
+
|
67
|
+
context "not found" do
|
68
|
+
let(:arguments) { meta[:not_found_id] }
|
69
|
+
let(:stub_pattern) { "destroy-404" }
|
70
|
+
|
71
|
+
it_behaves_like "a not found response"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Auth::TwoFactorAuth do
|
4
|
+
describe_method "status" do
|
5
|
+
let(:stub_pattern) { "status" }
|
6
|
+
|
7
|
+
it_behaves_like "a singular object response"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe_method "initiate" do
|
11
|
+
context "success" do
|
12
|
+
let(:arguments) { Scalingo::Auth::TwoFactorAuth::DEFAULT_PROVIDER }
|
13
|
+
let(:stub_pattern) { "initiate-success" }
|
14
|
+
|
15
|
+
it_behaves_like "a singular object response", 201
|
16
|
+
end
|
17
|
+
|
18
|
+
context "wrong provider" do
|
19
|
+
let(:arguments) { meta[:initiate][:invalid] }
|
20
|
+
let(:stub_pattern) { "initiate-wrong-provider" }
|
21
|
+
|
22
|
+
it_behaves_like "a client error"
|
23
|
+
end
|
24
|
+
|
25
|
+
context "already enabled" do
|
26
|
+
let(:stub_pattern) { "initiate-already-enabled" }
|
27
|
+
|
28
|
+
it_behaves_like "a client error"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe_method "validate" do
|
33
|
+
context "success" do
|
34
|
+
let(:arguments) { meta[:validate][:valid] }
|
35
|
+
let(:stub_pattern) { "validate-success" }
|
36
|
+
let(:expected_keys) { %i[codes user] }
|
37
|
+
|
38
|
+
it_behaves_like "a singular object response", 201
|
39
|
+
end
|
40
|
+
|
41
|
+
context "wrong provider" do
|
42
|
+
let(:arguments) { meta[:validate][:invalid] }
|
43
|
+
let(:stub_pattern) { "validate-wrong" }
|
44
|
+
|
45
|
+
it_behaves_like "a client error"
|
46
|
+
end
|
47
|
+
|
48
|
+
context "already enabled" do
|
49
|
+
let(:arguments) { meta[:validate][:invalid] }
|
50
|
+
let(:stub_pattern) { "validate-not-initiated" }
|
51
|
+
|
52
|
+
it_behaves_like "a client error"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe_method "disable" do
|
57
|
+
context "success" do
|
58
|
+
let(:stub_pattern) { "disable-success" }
|
59
|
+
|
60
|
+
it_behaves_like "a singular object response"
|
61
|
+
end
|
62
|
+
|
63
|
+
context "not enabled" do
|
64
|
+
let(:stub_pattern) { "disable-not-initiated" }
|
65
|
+
|
66
|
+
it_behaves_like "a client error"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Auth::User do
|
4
|
+
describe_method "self" do
|
5
|
+
let(:stub_pattern) { "self" }
|
6
|
+
|
7
|
+
it_behaves_like "a singular object response"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe_method "update" do
|
11
|
+
context "success" do
|
12
|
+
let(:arguments) { meta[:update][:valid] }
|
13
|
+
let(:stub_pattern) { "update-200" }
|
14
|
+
|
15
|
+
it_behaves_like "a singular object response"
|
16
|
+
end
|
17
|
+
|
18
|
+
context "unprocessable" do
|
19
|
+
let(:arguments) { meta[:update][:invalid] }
|
20
|
+
let(:stub_pattern) { "update-422" }
|
21
|
+
|
22
|
+
it_behaves_like "an unprocessable request"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Regional::Addons do
|
4
|
+
describe_method "categories" do
|
5
|
+
context "guest" do
|
6
|
+
subject { guest_endpoint }
|
7
|
+
|
8
|
+
let(:expected_count) { 2 }
|
9
|
+
let(:stub_pattern) { "categories-guest" }
|
10
|
+
|
11
|
+
it_behaves_like "a collection response"
|
12
|
+
it_behaves_like "a non-paginated collection"
|
13
|
+
end
|
14
|
+
|
15
|
+
context "logged" do
|
16
|
+
let(:expected_count) { 2 }
|
17
|
+
let(:stub_pattern) { "categories-logged" }
|
18
|
+
|
19
|
+
it_behaves_like "a collection response"
|
20
|
+
it_behaves_like "a non-paginated collection"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe_method "providers" do
|
25
|
+
context "guest" do
|
26
|
+
subject { guest_endpoint }
|
27
|
+
|
28
|
+
let(:expected_count) { 9 }
|
29
|
+
let(:stub_pattern) { "providers-guest" }
|
30
|
+
|
31
|
+
it_behaves_like "a collection response"
|
32
|
+
it_behaves_like "a non-paginated collection"
|
33
|
+
end
|
34
|
+
|
35
|
+
context "logged" do
|
36
|
+
let(:expected_count) { 11 }
|
37
|
+
let(:stub_pattern) { "providers-logged" }
|
38
|
+
|
39
|
+
it_behaves_like "a collection response"
|
40
|
+
it_behaves_like "a non-paginated collection"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe_method "provision" do
|
45
|
+
context "success" do
|
46
|
+
let(:arguments) { [meta[:app_id], meta[:provision][:valid]] }
|
47
|
+
let(:stub_pattern) { "provision-201" }
|
48
|
+
|
49
|
+
it_behaves_like "a singular object response", 201
|
50
|
+
end
|
51
|
+
|
52
|
+
context "failure" do
|
53
|
+
let(:arguments) { [meta[:app_id], meta[:provision][:invalid]] }
|
54
|
+
let(:stub_pattern) { "provision-400" }
|
55
|
+
|
56
|
+
it_behaves_like "a client error"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe_method "for" do
|
61
|
+
context "success" do
|
62
|
+
let(:arguments) { meta[:app_id] }
|
63
|
+
let(:stub_pattern) { "for-200" }
|
64
|
+
|
65
|
+
it_behaves_like "a collection response"
|
66
|
+
it_behaves_like "a non-paginated collection"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe_method "find" do
|
71
|
+
context "success" do
|
72
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
73
|
+
let(:stub_pattern) { "find-200" }
|
74
|
+
|
75
|
+
it_behaves_like "a singular object response"
|
76
|
+
end
|
77
|
+
|
78
|
+
context "not found" do
|
79
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
80
|
+
let(:stub_pattern) { "find-404" }
|
81
|
+
|
82
|
+
it_behaves_like "a not found response"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe_method "sso" do
|
87
|
+
context "success" do
|
88
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
89
|
+
let(:stub_pattern) { "sso-200" }
|
90
|
+
|
91
|
+
it_behaves_like "a singular object response"
|
92
|
+
end
|
93
|
+
|
94
|
+
context "not found" do
|
95
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
96
|
+
let(:stub_pattern) { "sso-404" }
|
97
|
+
|
98
|
+
it_behaves_like "a not found response"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe_method "update" do
|
103
|
+
context "success" do
|
104
|
+
let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:valid]] }
|
105
|
+
let(:stub_pattern) { "update-200" }
|
106
|
+
|
107
|
+
it_behaves_like "a singular object response"
|
108
|
+
end
|
109
|
+
|
110
|
+
context "failure" do
|
111
|
+
let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:invalid]] }
|
112
|
+
let(:stub_pattern) { "update-404" }
|
113
|
+
|
114
|
+
it_behaves_like "a not found response"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe_method "destroy" do
|
119
|
+
context "success" do
|
120
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
121
|
+
let(:stub_pattern) { "destroy-204" }
|
122
|
+
|
123
|
+
it_behaves_like "an empty response"
|
124
|
+
end
|
125
|
+
|
126
|
+
context "not found" do
|
127
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
128
|
+
let(:stub_pattern) { "destroy-404" }
|
129
|
+
|
130
|
+
it_behaves_like "a not found response"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Regional::Apps do
|
4
|
+
describe_method "all" do
|
5
|
+
let(:expected_count) { 2 }
|
6
|
+
let(:stub_pattern) { "all" }
|
7
|
+
|
8
|
+
it_behaves_like "a collection response"
|
9
|
+
it_behaves_like "a non-paginated collection"
|
10
|
+
end
|
11
|
+
|
12
|
+
describe_method "create" do
|
13
|
+
context "success" do
|
14
|
+
let(:arguments) { meta[:create][:valid] }
|
15
|
+
let(:stub_pattern) { "create-201" }
|
16
|
+
|
17
|
+
it_behaves_like "a singular object response", 201
|
18
|
+
end
|
19
|
+
|
20
|
+
context "failure" do
|
21
|
+
let(:arguments) { meta[:create][:invalid] }
|
22
|
+
let(:stub_pattern) { "create-422" }
|
23
|
+
|
24
|
+
it_behaves_like "an unprocessable request"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe_method "find" do
|
29
|
+
context "success" do
|
30
|
+
let(:arguments) { meta[:id] }
|
31
|
+
let(:stub_pattern) { "find-200" }
|
32
|
+
|
33
|
+
it_behaves_like "a singular object response"
|
34
|
+
end
|
35
|
+
|
36
|
+
context "not found" do
|
37
|
+
let(:arguments) { meta[:not_found_id] }
|
38
|
+
let(:stub_pattern) { "find-404" }
|
39
|
+
|
40
|
+
it_behaves_like "a not found response"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe_method "update" do
|
45
|
+
context "success" do
|
46
|
+
let(:arguments) { [meta[:id], meta[:update][:valid]] }
|
47
|
+
let(:stub_pattern) { "update-200" }
|
48
|
+
|
49
|
+
it_behaves_like "a singular object response"
|
50
|
+
end
|
51
|
+
|
52
|
+
context "invalid stack" do
|
53
|
+
let(:arguments) { [meta[:id], meta[:update][:invalid]] }
|
54
|
+
let(:stub_pattern) { "update-stack-404" }
|
55
|
+
|
56
|
+
it_behaves_like "a not found response"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe_method "logs_url" do
|
61
|
+
context "success" do
|
62
|
+
let(:arguments) { meta[:id] }
|
63
|
+
let(:stub_pattern) { "logs_url" }
|
64
|
+
|
65
|
+
it_behaves_like "a singular object response"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe_method "destroy" do
|
70
|
+
context "success" do
|
71
|
+
let(:arguments) { [meta[:id], meta[:destroy][:valid]] }
|
72
|
+
let(:stub_pattern) { "destroy-204" }
|
73
|
+
|
74
|
+
it_behaves_like "an empty response"
|
75
|
+
end
|
76
|
+
|
77
|
+
context "not found" do
|
78
|
+
let(:arguments) { [meta[:not_found_id], meta[:destroy][:valid]] }
|
79
|
+
let(:stub_pattern) { "destroy-404" }
|
80
|
+
|
81
|
+
it_behaves_like "a not found response"
|
82
|
+
end
|
83
|
+
|
84
|
+
context "unprocessable" do
|
85
|
+
let(:arguments) { [meta[:id], meta[:destroy][:invalid]] }
|
86
|
+
let(:stub_pattern) { "destroy-422" }
|
87
|
+
|
88
|
+
it_behaves_like "an unprocessable request"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe_method "rename" do
|
93
|
+
context "success" do
|
94
|
+
let(:arguments) { [meta[:id], meta[:rename][:valid]] }
|
95
|
+
let(:stub_pattern) { "rename-200" }
|
96
|
+
|
97
|
+
it_behaves_like "a singular object response"
|
98
|
+
end
|
99
|
+
|
100
|
+
context "not found" do
|
101
|
+
let(:arguments) { [meta[:not_found_id], meta[:rename][:valid]] }
|
102
|
+
let(:stub_pattern) { "rename-404" }
|
103
|
+
|
104
|
+
it_behaves_like "a not found response"
|
105
|
+
end
|
106
|
+
|
107
|
+
context "unprocessable" do
|
108
|
+
let(:arguments) { [meta[:id], meta[:rename][:invalid]] }
|
109
|
+
let(:stub_pattern) { "rename-422" }
|
110
|
+
|
111
|
+
it_behaves_like "an unprocessable request"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe_method "transfer" do
|
116
|
+
context "success" do
|
117
|
+
let(:arguments) { [meta[:id], meta[:transfer][:valid]] }
|
118
|
+
let(:stub_pattern) { "transfer-200" }
|
119
|
+
|
120
|
+
it_behaves_like "a singular object response"
|
121
|
+
end
|
122
|
+
|
123
|
+
context "not found" do
|
124
|
+
let(:arguments) { [meta[:not_found_id], meta[:transfer][:valid]] }
|
125
|
+
let(:stub_pattern) { "transfer-404" }
|
126
|
+
|
127
|
+
it_behaves_like "a not found response"
|
128
|
+
end
|
129
|
+
|
130
|
+
context "unprocessable" do
|
131
|
+
let(:arguments) { [meta[:id], meta[:transfer][:invalid]] }
|
132
|
+
let(:stub_pattern) { "transfer-422" }
|
133
|
+
|
134
|
+
it_behaves_like "an unprocessable request"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Regional::Collaborators do
|
4
|
+
describe_method "for" do
|
5
|
+
context "success" do
|
6
|
+
let(:arguments) { meta[:app_id] }
|
7
|
+
let(:stub_pattern) { "for-200" }
|
8
|
+
|
9
|
+
it_behaves_like "a collection response"
|
10
|
+
it_behaves_like "a non-paginated collection"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe_method "invite" do
|
15
|
+
context "success" do
|
16
|
+
let(:arguments) { [meta[:app_id], meta[:invite][:valid]] }
|
17
|
+
let(:stub_pattern) { "invite-201" }
|
18
|
+
|
19
|
+
it_behaves_like "a singular object response", 201
|
20
|
+
end
|
21
|
+
|
22
|
+
context "failure" do
|
23
|
+
let(:arguments) { [meta[:app_id], meta[:invite][:invalid]] }
|
24
|
+
let(:stub_pattern) { "invite-422" }
|
25
|
+
|
26
|
+
it_behaves_like "an unprocessable request"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe_method "accept" do
|
31
|
+
context "success" do
|
32
|
+
let(:arguments) { meta[:accept][:valid] }
|
33
|
+
let(:stub_pattern) { "accept-200" }
|
34
|
+
let(:expected_keys) { %i[app] }
|
35
|
+
|
36
|
+
it_behaves_like "a singular object response"
|
37
|
+
end
|
38
|
+
|
39
|
+
context "already collaborating" do
|
40
|
+
let(:arguments) { meta[:accept][:valid] }
|
41
|
+
let(:stub_pattern) { "accept-400" }
|
42
|
+
|
43
|
+
it_behaves_like "a client error"
|
44
|
+
end
|
45
|
+
|
46
|
+
context "not found" do
|
47
|
+
let(:arguments) { meta[:accept][:invalid] }
|
48
|
+
let(:stub_pattern) { "accept-404" }
|
49
|
+
|
50
|
+
it_behaves_like "a not found response"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe_method "destroy" do
|
55
|
+
context "success" do
|
56
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
57
|
+
let(:stub_pattern) { "destroy-204" }
|
58
|
+
|
59
|
+
it_behaves_like "an empty response"
|
60
|
+
end
|
61
|
+
|
62
|
+
context "not found" do
|
63
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
64
|
+
let(:stub_pattern) { "destroy-404" }
|
65
|
+
|
66
|
+
it_behaves_like "a not found response"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|