elasticsearch-api 0.4.11 → 1.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -6
- data/README.md +3 -4
- data/lib/elasticsearch/api.rb +16 -9
- data/lib/elasticsearch/api/actions/cat/aliases.rb +67 -0
- data/lib/elasticsearch/api/actions/cat/allocation.rb +69 -0
- data/lib/elasticsearch/api/actions/cat/count.rb +59 -0
- data/lib/elasticsearch/api/actions/cat/health.rb +43 -0
- data/lib/elasticsearch/api/actions/cat/help.rb +25 -0
- data/lib/elasticsearch/api/actions/cat/indices.rb +77 -0
- data/lib/elasticsearch/api/actions/cat/master.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/nodes.rb +38 -0
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/recovery.rb +73 -0
- data/lib/elasticsearch/api/actions/cat/shards.rb +72 -0
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +3 -1
- data/lib/elasticsearch/api/actions/cluster/state.rb +23 -14
- data/lib/elasticsearch/api/actions/count_percolate.rb +78 -0
- data/lib/elasticsearch/api/actions/indices/exists.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +34 -0
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +6 -3
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +8 -3
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +7 -2
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -2
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -4
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -1
- data/lib/elasticsearch/api/actions/mpercolate.rb +58 -0
- data/lib/elasticsearch/api/actions/mtermvectors.rb +67 -0
- data/lib/elasticsearch/api/actions/{cluster/node_hot_threads.rb → nodes/hot_threads.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_info.rb → nodes/info.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_shutdown.rb → nodes/shutdown.rb} +3 -3
- data/lib/elasticsearch/api/actions/nodes/stats.rb +79 -0
- data/lib/elasticsearch/api/actions/percolate.rb +67 -21
- data/lib/elasticsearch/api/actions/snapshot/create.rb +48 -0
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +41 -0
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +38 -0
- data/lib/elasticsearch/api/actions/snapshot/get.rb +47 -0
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +42 -0
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +53 -0
- data/lib/elasticsearch/api/actions/termvector.rb +77 -0
- data/lib/elasticsearch/api/namespace/cat.rb +20 -0
- data/lib/elasticsearch/api/namespace/nodes.rb +20 -0
- data/lib/elasticsearch/api/namespace/snapshot.rb +20 -0
- data/lib/elasticsearch/api/utils.rb +2 -4
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +37 -8
- data/test/unit/cat/aliases_test.rb +26 -0
- data/test/unit/cat/allocation_test.rb +26 -0
- data/test/unit/cat/count_test.rb +26 -0
- data/test/unit/cat/health_test.rb +26 -0
- data/test/unit/cat/help_test.rb +26 -0
- data/test/unit/cat/indices_test.rb +26 -0
- data/test/unit/cat/master_test.rb +26 -0
- data/test/unit/cat/nodes_test.rb +26 -0
- data/test/unit/cat/pending_tasks_test.rb +26 -0
- data/test/unit/cat/recovery_test.rb +26 -0
- data/test/unit/cat/shards_test.rb +26 -0
- data/test/unit/cluster/state_test.rb +12 -3
- data/test/unit/count_percolate_test.rb +26 -0
- data/test/unit/indices/exists_alias_test.rb +0 -6
- data/test/unit/indices/exists_template_test.rb +59 -0
- data/test/unit/indices/get_alias_test.rb +0 -6
- data/test/unit/indices/get_aliases_test.rb +10 -0
- data/test/unit/indices/get_field_mapping_test.rb +1 -1
- data/test/unit/indices/get_mapping_test.rb +3 -3
- data/test/unit/indices/get_settings_test.rb +10 -0
- data/test/unit/indices/get_warmer_test.rb +0 -6
- data/test/unit/indices/put_alias_test.rb +0 -6
- data/test/unit/indices/put_mapping_test.rb +5 -11
- data/test/unit/indices/put_settings_test.rb +9 -0
- data/test/unit/indices/put_warmer_test.rb +0 -6
- data/test/unit/mpercolate_test.rb +51 -0
- data/test/unit/mtermvectors_test.rb +38 -0
- data/test/unit/{cluster/node_hot_threads_test.rb → nodes/hot_threads_test.rb} +5 -5
- data/test/unit/{cluster/node_info_test.rb → nodes/info_test.rb} +6 -6
- data/test/unit/{cluster/node_shutdown_test.rb → nodes/shutdown_test.rb} +6 -6
- data/test/unit/{cluster/node_stats_test.rb → nodes/stats_test.rb} +10 -10
- data/test/unit/percolate_test.rb +2 -13
- data/test/unit/snapshot/create_repository_test.rb +38 -0
- data/test/unit/snapshot/create_test.rb +38 -0
- data/test/unit/snapshot/delete_repository_test.rb +35 -0
- data/test/unit/snapshot/delete_test.rb +38 -0
- data/test/unit/snapshot/get_repository_test.rb +26 -0
- data/test/unit/snapshot/get_test.rb +38 -0
- data/test/unit/snapshot/restore_test.rb +38 -0
- data/test/unit/termvector_test.rb +44 -0
- data/test/unit/utils_test.rb +11 -0
- metadata +89 -17
- data/lib/elasticsearch/api/actions/cluster/node_stats.rb +0 -75
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Elasticsearch
|
4
4
|
module Test
|
5
|
-
class
|
5
|
+
class NodesHotThreadsTest < ::Test::Unit::TestCase
|
6
6
|
|
7
|
-
context "
|
7
|
+
context "Nodes: Hot Threads" do
|
8
8
|
subject { FakeClient.new }
|
9
9
|
|
10
10
|
should "perform correct request" do
|
@@ -16,7 +16,7 @@ module Elasticsearch
|
|
16
16
|
true
|
17
17
|
end.returns(FakeResponse.new)
|
18
18
|
|
19
|
-
subject.
|
19
|
+
subject.nodes.hot_threads
|
20
20
|
end
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
@@ -25,7 +25,7 @@ module Elasticsearch
|
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
28
|
-
subject.
|
28
|
+
subject.nodes.hot_threads :node_id => 'foo'
|
29
29
|
end
|
30
30
|
|
31
31
|
should "URL-escape the parts" do
|
@@ -34,7 +34,7 @@ module Elasticsearch
|
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new)
|
36
36
|
|
37
|
-
subject.
|
37
|
+
subject.nodes.hot_threads :node_id => 'foo^bar'
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Elasticsearch
|
4
4
|
module Test
|
5
|
-
class
|
5
|
+
class NodesInfoTest < ::Test::Unit::TestCase
|
6
6
|
|
7
|
-
context "
|
7
|
+
context "Nodes: Info" do
|
8
8
|
subject { FakeClient.new }
|
9
9
|
|
10
10
|
should "perform correct request" do
|
@@ -16,7 +16,7 @@ module Elasticsearch
|
|
16
16
|
true
|
17
17
|
end.returns(FakeResponse.new)
|
18
18
|
|
19
|
-
subject.
|
19
|
+
subject.nodes.info
|
20
20
|
end
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
@@ -25,7 +25,7 @@ module Elasticsearch
|
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
28
|
-
subject.
|
28
|
+
subject.nodes.info :node_id => 'foo'
|
29
29
|
end
|
30
30
|
|
31
31
|
should "send multiple :node_id-s correctly" do
|
@@ -34,8 +34,8 @@ module Elasticsearch
|
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new).twice
|
36
36
|
|
37
|
-
subject.
|
38
|
-
subject.
|
37
|
+
subject.nodes.info :node_id => 'A,B,C'
|
38
|
+
subject.nodes.info :node_id => ['A', 'B', 'C']
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Elasticsearch
|
4
4
|
module Test
|
5
|
-
class
|
5
|
+
class NodesShutdownTest < ::Test::Unit::TestCase
|
6
6
|
|
7
|
-
context "
|
7
|
+
context "Nodes: Shutdown" do
|
8
8
|
subject { FakeClient.new }
|
9
9
|
|
10
10
|
should "perform correct request" do
|
@@ -16,7 +16,7 @@ module Elasticsearch
|
|
16
16
|
true
|
17
17
|
end.returns(FakeResponse.new)
|
18
18
|
|
19
|
-
subject.
|
19
|
+
subject.nodes.shutdown
|
20
20
|
end
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
@@ -25,7 +25,7 @@ module Elasticsearch
|
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
28
|
-
subject.
|
28
|
+
subject.nodes.shutdown :node_id => 'foo'
|
29
29
|
end
|
30
30
|
|
31
31
|
should "send multiple :node_id-s correctly" do
|
@@ -34,8 +34,8 @@ module Elasticsearch
|
|
34
34
|
true
|
35
35
|
end.returns(FakeResponse.new).twice
|
36
36
|
|
37
|
-
subject.
|
38
|
-
subject.
|
37
|
+
subject.nodes.shutdown :node_id => 'A,B,C'
|
38
|
+
subject.nodes.shutdown :node_id => ['A', 'B', 'C']
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Elasticsearch
|
4
4
|
module Test
|
5
|
-
class
|
5
|
+
class NodesStatsTest < ::Test::Unit::TestCase
|
6
6
|
|
7
|
-
context "
|
7
|
+
context "Nodes: Stats" do
|
8
8
|
subject { FakeClient.new }
|
9
9
|
|
10
10
|
should "perform correct request" do
|
@@ -16,7 +16,7 @@ module Elasticsearch
|
|
16
16
|
true
|
17
17
|
end.returns(FakeResponse.new)
|
18
18
|
|
19
|
-
subject.
|
19
|
+
subject.nodes.stats
|
20
20
|
end
|
21
21
|
|
22
22
|
should "send :node_id correctly" do
|
@@ -25,17 +25,17 @@ module Elasticsearch
|
|
25
25
|
true
|
26
26
|
end.returns(FakeResponse.new)
|
27
27
|
|
28
|
-
subject.
|
28
|
+
subject.nodes.stats :node_id => 'foo'
|
29
29
|
end
|
30
30
|
|
31
31
|
should "get specific metric families" do
|
32
32
|
subject.expects(:perform_request).with do |method, url, params, body|
|
33
|
-
assert_equal '_nodes/stats', url
|
34
|
-
assert_equal( {
|
33
|
+
assert_equal '_nodes/stats/http,fs', url
|
34
|
+
assert_equal( {}, params )
|
35
35
|
true
|
36
36
|
end.returns(FakeResponse.new)
|
37
37
|
|
38
|
-
subject.
|
38
|
+
subject.nodes.stats :metric => [:http, :fs]
|
39
39
|
end
|
40
40
|
|
41
41
|
should "get specific metric for the indices family" do
|
@@ -44,7 +44,7 @@ module Elasticsearch
|
|
44
44
|
true
|
45
45
|
end.returns(FakeResponse.new)
|
46
46
|
|
47
|
-
subject.
|
47
|
+
subject.nodes.stats :metric => :indices, :index_metric => 'filter_cache'
|
48
48
|
end
|
49
49
|
|
50
50
|
should "get fielddata statistics for the indices family" do
|
@@ -54,8 +54,8 @@ module Elasticsearch
|
|
54
54
|
true
|
55
55
|
end.returns(FakeResponse.new).twice
|
56
56
|
|
57
|
-
subject.
|
58
|
-
subject.
|
57
|
+
subject.nodes.stats :metric => 'indices', :index_metric => 'fielddata', :fields => 'foo,bar'
|
58
|
+
subject.nodes.stats :metric => 'indices', :index_metric => 'fielddata', :fields => ['foo','bar']
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
data/test/unit/percolate_test.rb
CHANGED
@@ -13,20 +13,9 @@ module Elasticsearch
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
should "require the :
|
16
|
+
should "require the :type argument" do
|
17
17
|
assert_raise ArgumentError do
|
18
|
-
subject.percolate :index => 'bar'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
should "have default document type" do
|
23
|
-
assert_nothing_raised do
|
24
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
25
|
-
assert_equal 'foo/document/_percolate', url
|
26
|
-
true
|
27
|
-
end.returns(FakeResponse.new)
|
28
|
-
|
29
|
-
subject.percolate :index => 'foo', :body => {}
|
18
|
+
subject.percolate :index => 'bar', :body => {}
|
30
19
|
end
|
31
20
|
end
|
32
21
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotCreateRepositoryTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Create repository" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "require the :repository argument" do
|
11
|
+
assert_raise ArgumentError do
|
12
|
+
subject.snapshot.create_repository :body => {}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should "require the :body argument" do
|
17
|
+
assert_raise ArgumentError do
|
18
|
+
subject.snapshot.create_repository :repository => 'foo'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform correct request" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal 'PUT', method
|
25
|
+
assert_equal '_snapshot/foo', url
|
26
|
+
assert_equal Hash.new, params
|
27
|
+
assert_equal Hash.new, body
|
28
|
+
true
|
29
|
+
end.returns(FakeResponse.new)
|
30
|
+
|
31
|
+
subject.snapshot.create_repository :repository => 'foo', :body => {}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotCreateTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Create" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "require the :repository argument" do
|
11
|
+
assert_raise ArgumentError do
|
12
|
+
subject.snapshot.create :snapshot => 'bar', :body => {}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should "require the :snapshot argument" do
|
17
|
+
assert_raise ArgumentError do
|
18
|
+
subject.snapshot.create :repository => 'foo', :body => {}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform correct request" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal 'PUT', method
|
25
|
+
assert_equal '_snapshot/foo/bar', url
|
26
|
+
assert_equal Hash.new, params
|
27
|
+
assert_equal Hash.new, body
|
28
|
+
true
|
29
|
+
end.returns(FakeResponse.new)
|
30
|
+
|
31
|
+
subject.snapshot.create :repository => 'foo', :snapshot => 'bar', :body => {}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotDeleteRepositoryTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Delete repository" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "perform correct request" do
|
11
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
+
assert_equal 'DELETE', method
|
13
|
+
assert_equal '_snapshot/foo', url
|
14
|
+
assert_equal Hash.new, params
|
15
|
+
assert_nil body
|
16
|
+
true
|
17
|
+
end.returns(FakeResponse.new)
|
18
|
+
|
19
|
+
subject.snapshot.delete_repository :repository => 'foo'
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform the request for more indices" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal '_snapshot/foo,bar', url
|
25
|
+
true
|
26
|
+
end.returns(FakeResponse.new)
|
27
|
+
|
28
|
+
subject.snapshot.delete_repository :repository => ['foo','bar']
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotDeleteTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Delete" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "require the :repository argument" do
|
11
|
+
assert_raise ArgumentError do
|
12
|
+
subject.snapshot.delete :snapshot => 'bar', :body => {}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should "require the :snapshot argument" do
|
17
|
+
assert_raise ArgumentError do
|
18
|
+
subject.snapshot.delete :repository => 'foo', :body => {}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform correct request" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal 'DELETE', method
|
25
|
+
assert_equal '_snapshot/foo/bar', url
|
26
|
+
assert_equal Hash.new, params
|
27
|
+
assert_nil body
|
28
|
+
true
|
29
|
+
end.returns(FakeResponse.new)
|
30
|
+
|
31
|
+
subject.snapshot.delete :repository => 'foo', :snapshot => 'bar'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotGetRepositoryTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Get repository" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "perform correct request" do
|
11
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
12
|
+
assert_equal 'GET', method
|
13
|
+
assert_equal '_snapshot/foo', url
|
14
|
+
assert_equal Hash.new, params
|
15
|
+
assert_nil body
|
16
|
+
true
|
17
|
+
end.returns(FakeResponse.new)
|
18
|
+
|
19
|
+
subject.snapshot.get_repository :repository => 'foo'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotGetTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Get" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "require the :repository argument" do
|
11
|
+
assert_raise ArgumentError do
|
12
|
+
subject.snapshot.get :snapshot => 'bar', :body => {}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should "require the :snapshot argument" do
|
17
|
+
assert_raise ArgumentError do
|
18
|
+
subject.snapshot.get :repository => 'foo', :body => {}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform correct request" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal 'GET', method
|
25
|
+
assert_equal '_snapshot/foo/bar', url
|
26
|
+
assert_equal Hash.new, params
|
27
|
+
assert_nil body
|
28
|
+
true
|
29
|
+
end.returns(FakeResponse.new)
|
30
|
+
|
31
|
+
subject.snapshot.get :repository => 'foo', :snapshot => 'bar'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Elasticsearch
|
4
|
+
module Test
|
5
|
+
class SnapshotRestoreTest < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
context "Snapshot: Restore" do
|
8
|
+
subject { FakeClient.new }
|
9
|
+
|
10
|
+
should "require the :repository argument" do
|
11
|
+
assert_raise ArgumentError do
|
12
|
+
subject.snapshot.restore :snapshot => 'bar'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should "require the :snapshot argument" do
|
17
|
+
assert_raise ArgumentError do
|
18
|
+
subject.snapshot.restore :repository => 'foo'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "perform correct request" do
|
23
|
+
subject.expects(:perform_request).with do |method, url, params, body|
|
24
|
+
assert_equal 'POST', method
|
25
|
+
assert_equal '_snapshot/foo/bar/_restore', url
|
26
|
+
assert_equal Hash.new, params
|
27
|
+
assert_equal nil, body
|
28
|
+
true
|
29
|
+
end.returns(FakeResponse.new)
|
30
|
+
|
31
|
+
subject.snapshot.restore :repository => 'foo', :snapshot => 'bar'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|