rainforest 1.0.7 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -6
- data/.travis.yml +13 -1
- data/Gemfile +6 -0
- data/README.md +72 -21
- data/Rakefile +6 -13
- data/VERSION +1 -1
- data/bin/rainforest-console +1 -1
- data/gemfiles/default-with-activesupport.gemfile +8 -1
- data/gemfiles/json.gemfile +10 -2
- data/gemfiles/yajl.gemfile +10 -2
- data/lib/rainforest.rb +61 -240
- data/lib/rainforest/apibits/api_client.rb +28 -0
- data/lib/rainforest/apibits/api_endpoint.rb +11 -0
- data/lib/rainforest/apibits/api_list.rb +88 -0
- data/lib/rainforest/apibits/api_method.rb +95 -0
- data/lib/rainforest/apibits/api_object.rb +52 -0
- data/lib/rainforest/apibits/api_resource.rb +153 -0
- data/lib/rainforest/apibits/headers_builder.rb +47 -0
- data/lib/rainforest/apibits/params_builder.rb +27 -0
- data/lib/rainforest/apibits/path_builder.rb +38 -0
- data/lib/rainforest/apibits/requester.rb +104 -0
- data/lib/rainforest/apibits/util.rb +51 -0
- data/lib/rainforest/clients/default_client.rb +59 -0
- data/lib/rainforest/endpoints/client_stats_endpoint.rb +11 -0
- data/lib/rainforest/endpoints/environment_runs_endpoint.rb +11 -0
- data/lib/rainforest/endpoints/environments_endpoint.rb +48 -0
- data/lib/rainforest/endpoints/generator_rows_endpoint.rb +17 -0
- data/lib/rainforest/endpoints/generators_endpoint.rb +48 -0
- data/lib/rainforest/endpoints/integrations_endpoint.rb +33 -0
- data/lib/rainforest/endpoints/run_tests_endpoint.rb +20 -0
- data/lib/rainforest/endpoints/runs_endpoint.rb +48 -0
- data/lib/rainforest/endpoints/schedules_endpoint.rb +48 -0
- data/lib/rainforest/endpoints/site_environments_endpoint.rb +24 -0
- data/lib/rainforest/endpoints/sites_endpoint.rb +39 -0
- data/lib/rainforest/endpoints/tests_endpoint.rb +57 -0
- data/lib/rainforest/endpoints/users_endpoint.rb +48 -0
- data/lib/rainforest/errors/api_connection_error.rb +1 -1
- data/lib/rainforest/errors/api_error.rb +32 -1
- data/lib/rainforest/errors/authentication_error.rb +1 -1
- data/lib/rainforest/errors/rainforest_error.rb +2 -9
- data/lib/rainforest/resources/client_stats.rb +31 -0
- data/lib/rainforest/resources/environment.rb +73 -0
- data/lib/rainforest/resources/generator.rb +73 -0
- data/lib/rainforest/resources/integration.rb +52 -0
- data/lib/rainforest/resources/run.rb +93 -0
- data/lib/rainforest/resources/schedule.rb +63 -0
- data/lib/rainforest/resources/site.rb +53 -0
- data/lib/rainforest/resources/site_environment.rb +40 -0
- data/lib/rainforest/resources/test.rb +98 -0
- data/lib/rainforest/resources/user.rb +75 -0
- data/rainforest.gemspec +8 -6
- data/test/rainforest/api_client_test.rb +51 -0
- data/test/rainforest/api_endpoint_test.rb +13 -0
- data/test/rainforest/api_list_test.rb +49 -0
- data/test/rainforest/api_method_test.rb +78 -0
- data/test/rainforest/headers_builder_test.rb +28 -0
- data/test/rainforest/params_builder_test.rb +57 -0
- data/test/rainforest/path_builder_test.rb +50 -0
- data/test/rainforest/requester_test.rb +86 -0
- data/test/rainforest/util_test.rb +41 -19
- data/test/test_data.rb +72 -0
- data/test/test_helper.rb +17 -134
- metadata +99 -59
- data/CONTRIBUTORS +0 -2
- data/History.txt +0 -4
- data/LICENSE +0 -21
- data/lib/data/ca-certificates.crt +0 -3918
- data/lib/rainforest/api_operations/create.rb +0 -16
- data/lib/rainforest/api_operations/delete.rb +0 -11
- data/lib/rainforest/api_operations/list.rb +0 -16
- data/lib/rainforest/api_operations/update.rb +0 -61
- data/lib/rainforest/api_resource.rb +0 -33
- data/lib/rainforest/errors/invalid_request_error.rb +0 -10
- data/lib/rainforest/json.rb +0 -21
- data/lib/rainforest/list_object.rb +0 -35
- data/lib/rainforest/rainforest_object.rb +0 -165
- data/lib/rainforest/run.rb +0 -8
- data/lib/rainforest/singleton_api_resource.rb +0 -20
- data/lib/rainforest/util.rb +0 -100
- data/test/rainforest/api_resource_test.rb +0 -11
- data/test/rainforest/auth_test.rb +0 -24
- data/test/rainforest/list_object_test.rb +0 -7
- data/test/rainforest/metadata_test.rb +0 -7
- data/test/rainforest/run_test.rb +0 -36
@@ -1,11 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path('../../test_helper', __FILE__)
|
3
|
-
|
4
|
-
module Rainforest
|
5
|
-
class ApiResourceTest < ::Test::Unit::TestCase
|
6
|
-
should "creating a new APIResource should not fetch over the network" do
|
7
|
-
@mock.expects(:get).never
|
8
|
-
c = Rainforest::Run.new("someid")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.expand_path('../../test_helper', __FILE__)
|
3
|
-
|
4
|
-
module Rainforest
|
5
|
-
class AuthTest < ::Test::Unit::TestCase
|
6
|
-
context "With a valid api token, any request" do
|
7
|
-
should "not raise an exception" do
|
8
|
-
response = test_response({}, 200)
|
9
|
-
@mock.expects(:get).once.returns(response)
|
10
|
-
Rainforest::Run.retrieve("1")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context "With an invalid api token, any request" do
|
15
|
-
should "raise an exception" do
|
16
|
-
response = test_response({error:"Authentication required"}, 401)
|
17
|
-
assert_raises AuthenticationError do
|
18
|
-
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 401))
|
19
|
-
Rainforest::Run.retrieve("1")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
data/test/rainforest/run_test.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', __FILE__)
|
2
|
-
|
3
|
-
module Rainforest
|
4
|
-
class RunTest < ::Test::Unit::TestCase
|
5
|
-
should "be listable" do
|
6
|
-
@mock.expects(:get).once.returns(test_response(test_run_array))
|
7
|
-
runs = Rainforest::Run.all
|
8
|
-
assert runs.data.kind_of? Array
|
9
|
-
|
10
|
-
runs.data.each do |run|
|
11
|
-
assert run.kind_of?(Rainforest::Run)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
should "be retrievable individually" do
|
16
|
-
@mock.expects(:get).once.returns(test_response(test_run))
|
17
|
-
run = Rainforest::Run.retrieve("test_run")
|
18
|
-
assert run.kind_of?(Rainforest::Run)
|
19
|
-
end
|
20
|
-
|
21
|
-
should "be abortable" do
|
22
|
-
@mock.expects(:get).once.returns(test_response(test_run))
|
23
|
-
@mock.expects(:delete).once.returns(test_response(test_run(state: "aborted")))
|
24
|
-
run = Rainforest::Run.retrieve("test_run")
|
25
|
-
run = run.delete
|
26
|
-
|
27
|
-
assert_equal("aborted", run.state)
|
28
|
-
end
|
29
|
-
|
30
|
-
should "be createable" do
|
31
|
-
@mock.expects(:post).once.returns(test_response(test_run))
|
32
|
-
run = Rainforest::Run.create(tests: ["all"])
|
33
|
-
assert run.kind_of?(Rainforest::Run)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|