gcloud 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +13 -5
  2. data/AUTHENTICATION.md +71 -0
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +10 -15
  5. data/lib/gcloud.rb +30 -0
  6. data/lib/gcloud/backoff.rb +3 -0
  7. data/lib/gcloud/credentials.rb +47 -30
  8. data/lib/gcloud/datastore.rb +246 -15
  9. data/lib/gcloud/datastore/connection.rb +4 -2
  10. data/lib/gcloud/datastore/credentials.rb +3 -1
  11. data/lib/gcloud/datastore/dataset.rb +130 -25
  12. data/lib/gcloud/datastore/dataset/lookup_results.rb +1 -0
  13. data/lib/gcloud/datastore/dataset/query_results.rb +7 -5
  14. data/lib/gcloud/datastore/entity.rb +99 -17
  15. data/lib/gcloud/datastore/errors.rb +13 -2
  16. data/lib/gcloud/datastore/key.rb +133 -2
  17. data/lib/gcloud/datastore/properties.rb +6 -1
  18. data/lib/gcloud/datastore/proto.rb +2 -1
  19. data/lib/gcloud/datastore/query.rb +4 -4
  20. data/lib/gcloud/datastore/transaction.rb +3 -0
  21. data/lib/gcloud/storage.rb +280 -13
  22. data/lib/gcloud/storage/bucket.rb +248 -11
  23. data/lib/gcloud/storage/bucket/acl.rb +631 -4
  24. data/lib/gcloud/storage/bucket/list.rb +1 -0
  25. data/lib/gcloud/storage/connection.rb +1 -0
  26. data/lib/gcloud/storage/credentials.rb +3 -1
  27. data/lib/gcloud/storage/errors.rb +9 -1
  28. data/lib/gcloud/storage/file.rb +231 -6
  29. data/lib/gcloud/storage/file/acl.rb +365 -2
  30. data/lib/gcloud/storage/file/list.rb +1 -0
  31. data/lib/gcloud/storage/file/verifier.rb +1 -0
  32. data/lib/gcloud/storage/project.rb +119 -10
  33. data/lib/gcloud/version.rb +18 -3
  34. metadata +33 -80
  35. data/.gemtest +0 -0
  36. data/.rubocop.yml +0 -17
  37. data/Manifest.txt +0 -66
  38. data/Rakefile +0 -35
  39. data/gcloud.gemspec +0 -63
  40. data/rakelib/console.rake +0 -28
  41. data/rakelib/manifest.rake +0 -24
  42. data/rakelib/proto.rake +0 -17
  43. data/rakelib/rubocop.rake +0 -17
  44. data/rakelib/test.rake +0 -144
  45. data/test/gcloud/datastore/proto/test_cursor.rb +0 -36
  46. data/test/gcloud/datastore/proto/test_direction.rb +0 -60
  47. data/test/gcloud/datastore/proto/test_operator.rb +0 -76
  48. data/test/gcloud/datastore/proto/test_value.rb +0 -231
  49. data/test/gcloud/datastore/test_connection.rb +0 -93
  50. data/test/gcloud/datastore/test_credentials.rb +0 -38
  51. data/test/gcloud/datastore/test_dataset.rb +0 -413
  52. data/test/gcloud/datastore/test_entity.rb +0 -161
  53. data/test/gcloud/datastore/test_entity_exclude.rb +0 -225
  54. data/test/gcloud/datastore/test_key.rb +0 -189
  55. data/test/gcloud/datastore/test_query.rb +0 -271
  56. data/test/gcloud/datastore/test_transaction.rb +0 -121
  57. data/test/gcloud/storage/test_backoff.rb +0 -127
  58. data/test/gcloud/storage/test_bucket.rb +0 -270
  59. data/test/gcloud/storage/test_bucket_acl.rb +0 -253
  60. data/test/gcloud/storage/test_default_acl.rb +0 -256
  61. data/test/gcloud/storage/test_file.rb +0 -221
  62. data/test/gcloud/storage/test_file_acl.rb +0 -367
  63. data/test/gcloud/storage/test_project.rb +0 -180
  64. data/test/gcloud/storage/test_storage.rb +0 -29
  65. data/test/gcloud/storage/test_verifier.rb +0 -62
  66. data/test/gcloud/test_version.rb +0 -8
  67. data/test/helper.rb +0 -91
@@ -1,60 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "helper"
16
- require "gcloud/datastore/entity"
17
- require "gcloud/datastore/key"
18
-
19
- ##
20
- # These tests are not part of the public API.
21
- # These tests are testing the implementation.
22
- # Similar to testing private methods.
23
-
24
- describe "Proto Direction methods" do
25
- describe "PropertyOrder Direction" do
26
- it "defaults to ascending" do
27
- assert_ascending nil
28
- assert_ascending ""
29
- assert_ascending 123
30
- end
31
-
32
- it "is ascending when ascending" do
33
- assert_ascending "asc"
34
- assert_ascending "ascending"
35
- assert_ascending :asc
36
- assert_ascending :ascending
37
- assert_ascending "ASC"
38
- assert_ascending "ASCENDING"
39
- end
40
-
41
- it "is descending when given 'd' direction" do
42
- assert_descending "desc"
43
- assert_descending "descending"
44
- assert_descending :desc
45
- assert_descending :descending
46
- assert_descending "DESC"
47
- assert_descending "DESCENDING"
48
- end
49
-
50
- def assert_ascending direction
51
- assert_equal Gcloud::Datastore::Proto::PropertyOrder::Direction::ASCENDING,
52
- Gcloud::Datastore::Proto.to_prop_order_direction(direction)
53
- end
54
-
55
- def assert_descending direction
56
- assert_equal Gcloud::Datastore::Proto::PropertyOrder::Direction::DESCENDING,
57
- Gcloud::Datastore::Proto.to_prop_order_direction(direction)
58
- end
59
- end
60
- end
@@ -1,76 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "helper"
16
- require "gcloud/datastore/entity"
17
- require "gcloud/datastore/key"
18
-
19
- ##
20
- # These tests are not part of the public API.
21
- # These tests are testing the implementation.
22
- # Similar to testing private methods.
23
-
24
- describe "Proto Operator methods" do
25
- describe "Property Filter Operators" do
26
- it "can convert strings" do
27
- assert_prop_filter_op "<" , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN
28
- assert_prop_filter_op "lt" , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN
29
- assert_prop_filter_op "<=" , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN_OR_EQUAL
30
- assert_prop_filter_op "lte" , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN_OR_EQUAL
31
- assert_prop_filter_op ">" , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN
32
- assert_prop_filter_op "gt" , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN
33
- assert_prop_filter_op ">=" , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN_OR_EQUAL
34
- assert_prop_filter_op "gte" , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN_OR_EQUAL
35
- assert_prop_filter_op "=" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
36
- assert_prop_filter_op "eq" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
37
- assert_prop_filter_op "eql" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
38
- assert_prop_filter_op "~" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
39
- assert_prop_filter_op "~>" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
40
- assert_prop_filter_op "ancestor" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
41
- assert_prop_filter_op "has_ancestor" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
42
- assert_prop_filter_op "has ancestor" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
43
- end
44
-
45
- it "can convert symbols" do
46
- assert_prop_filter_op :< , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN
47
- assert_prop_filter_op :lt , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN
48
- assert_prop_filter_op :<= , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN_OR_EQUAL
49
- assert_prop_filter_op :lte , Gcloud::Datastore::Proto::PropertyFilter::Operator::LESS_THAN_OR_EQUAL
50
- assert_prop_filter_op :> , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN
51
- assert_prop_filter_op :gt , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN
52
- assert_prop_filter_op :>= , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN_OR_EQUAL
53
- assert_prop_filter_op :gte , Gcloud::Datastore::Proto::PropertyFilter::Operator::GREATER_THAN_OR_EQUAL
54
- # := is not a valid symbol
55
- assert_prop_filter_op :"=" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
56
- assert_prop_filter_op :eq , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
57
- assert_prop_filter_op :eql , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
58
- assert_prop_filter_op :~ , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
59
- # :~> is not a valid symbol
60
- assert_prop_filter_op :"~>" , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
61
- assert_prop_filter_op :ancestor , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
62
- assert_prop_filter_op :has_ancestor , Gcloud::Datastore::Proto::PropertyFilter::Operator::HAS_ANCESTOR
63
- end
64
-
65
- it "can handle unexpected values" do
66
- assert_prop_filter_op nil , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
67
- assert_prop_filter_op "" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
68
- assert_prop_filter_op "foo" , Gcloud::Datastore::Proto::PropertyFilter::Operator::EQUAL
69
- end
70
-
71
- def assert_prop_filter_op string, proto
72
- op = Gcloud::Datastore::Proto.to_prop_filter_op string
73
- op.must_equal proto
74
- end
75
- end
76
- end
@@ -1,231 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "helper"
16
- require "gcloud/datastore/entity"
17
- require "gcloud/datastore/key"
18
-
19
- describe "Proto Value methods" do
20
- let(:time_obj) { Time.new(2014, 1, 1, 0, 0, 0, 0) }
21
- let(:time_num) { 1388534400000000 }
22
-
23
- ##
24
- # This is testing a helper.
25
- # These tests are for sanity only.
26
- # This is not part of the public API.
27
- # Testing implementation, not behavior.
28
-
29
- it "encodes a string" do
30
- raw = "hello, i am a string"
31
- value = Gcloud::Datastore::Proto.to_proto_value raw
32
- value.string_value.must_equal raw
33
- value.timestamp_microseconds_value.must_be :nil?
34
- value.key_value.must_be :nil?
35
- value.entity_value.must_be :nil?
36
- value.boolean_value.must_be :nil?
37
- value.double_value.must_be :nil?
38
- value.integer_value.must_be :nil?
39
- value.list_value.must_be :nil?
40
- end
41
-
42
- it "decodes a string" do
43
- str = "ohai, i am also a string"
44
- value = Gcloud::Datastore::Proto::Value.new
45
- value.string_value = str
46
- raw = Gcloud::Datastore::Proto.from_proto_value value
47
- raw.must_equal str
48
- end
49
-
50
- it "encodes true" do
51
- value = Gcloud::Datastore::Proto.to_proto_value true
52
- value.boolean_value.must_equal true
53
- value.timestamp_microseconds_value.must_be :nil?
54
- value.key_value.must_be :nil?
55
- value.entity_value.must_be :nil?
56
- value.double_value.must_be :nil?
57
- value.integer_value.must_be :nil?
58
- value.string_value.must_be :nil?
59
- value.list_value.must_be :nil?
60
- end
61
-
62
- it "decodes true" do
63
- value = Gcloud::Datastore::Proto::Value.new
64
- value.boolean_value = true
65
- raw = Gcloud::Datastore::Proto.from_proto_value value
66
- raw.must_equal true
67
- end
68
-
69
- it "encodes false" do
70
- value = Gcloud::Datastore::Proto.to_proto_value false
71
- value.boolean_value.must_equal false
72
- value.timestamp_microseconds_value.must_be :nil?
73
- value.key_value.must_be :nil?
74
- value.entity_value.must_be :nil?
75
- value.double_value.must_be :nil?
76
- value.integer_value.must_be :nil?
77
- value.string_value.must_be :nil?
78
- value.list_value.must_be :nil?
79
- end
80
-
81
- it "decodes false" do
82
- value = Gcloud::Datastore::Proto::Value.new
83
- value.boolean_value = false
84
- raw = Gcloud::Datastore::Proto.from_proto_value value
85
- raw.must_equal false
86
- end
87
-
88
- it "encodes Time" do
89
- value = Gcloud::Datastore::Proto.to_proto_value time_obj
90
- value.timestamp_microseconds_value.must_equal time_num
91
- value.key_value.must_be :nil?
92
- value.entity_value.must_be :nil?
93
- value.boolean_value.must_be :nil?
94
- value.double_value.must_be :nil?
95
- value.integer_value.must_be :nil?
96
- value.string_value.must_be :nil?
97
- value.list_value.must_be :nil?
98
- end
99
-
100
- it "decodes timestamp" do
101
- value = Gcloud::Datastore::Proto::Value.new
102
- value.timestamp_microseconds_value = time_num
103
- raw = Gcloud::Datastore::Proto.from_proto_value value
104
- raw.must_equal time_obj
105
- end
106
-
107
- it "encodes integer" do
108
- raw = 1234
109
- value = Gcloud::Datastore::Proto.to_proto_value raw
110
- value.integer_value.must_equal raw
111
- value.timestamp_microseconds_value.must_be :nil?
112
- value.key_value.must_be :nil?
113
- value.entity_value.must_be :nil?
114
- value.boolean_value.must_be :nil?
115
- value.double_value.must_be :nil?
116
- value.string_value.must_be :nil?
117
- value.list_value.must_be :nil?
118
- end
119
-
120
- it "decodes integer" do
121
- num = 1234
122
- value = Gcloud::Datastore::Proto::Value.new
123
- value.integer_value = num
124
- raw = Gcloud::Datastore::Proto.from_proto_value value
125
- raw.must_equal num
126
- end
127
-
128
- it "encodes float" do
129
- raw = 12.34
130
- value = Gcloud::Datastore::Proto.to_proto_value raw
131
- value.double_value.must_equal raw
132
- value.timestamp_microseconds_value.must_be :nil?
133
- value.key_value.must_be :nil?
134
- value.entity_value.must_be :nil?
135
- value.boolean_value.must_be :nil?
136
- value.integer_value.must_be :nil?
137
- value.string_value.must_be :nil?
138
- value.list_value.must_be :nil?
139
- end
140
-
141
- it "decodes float" do
142
- num = 12.34
143
- value = Gcloud::Datastore::Proto::Value.new
144
- value.double_value = num
145
- raw = Gcloud::Datastore::Proto.from_proto_value value
146
- raw.must_equal num
147
- end
148
-
149
- it "encodes Key" do
150
- key = Gcloud::Datastore::Key.new "Thing", 123
151
- value = Gcloud::Datastore::Proto.to_proto_value key
152
- value.key_value.must_equal key.to_proto
153
- value.timestamp_microseconds_value.must_be :nil?
154
- value.entity_value.must_be :nil?
155
- value.boolean_value.must_be :nil?
156
- value.double_value.must_be :nil?
157
- value.integer_value.must_be :nil?
158
- value.string_value.must_be :nil?
159
- value.list_value.must_be :nil?
160
- end
161
-
162
- it "decodes Key" do
163
- key = Gcloud::Datastore::Key.new "Thing", 123
164
- value = Gcloud::Datastore::Proto::Value.new
165
- value.key_value = key.to_proto
166
- raw = Gcloud::Datastore::Proto.from_proto_value value
167
- assert_kind_of Gcloud::Datastore::Key, raw
168
- refute_kind_of Gcloud::Datastore::Proto::Key, raw
169
- raw.to_proto.must_equal key.to_proto
170
- end
171
-
172
- it "encodes Entity" do
173
- entity = Gcloud::Datastore::Entity.new
174
- entity.key = Gcloud::Datastore::Key.new "Thing", 123
175
- entity["name"] = "Thing 1"
176
- value = Gcloud::Datastore::Proto.to_proto_value entity
177
- value.key_value.must_be :nil?
178
- value.entity_value.must_equal entity.to_proto
179
- value.timestamp_microseconds_value.must_be :nil?
180
- value.boolean_value.must_be :nil?
181
- value.double_value.must_be :nil?
182
- value.integer_value.must_be :nil?
183
- value.string_value.must_be :nil?
184
- value.list_value.must_be :nil?
185
- end
186
-
187
- it "decodes Entity" do
188
- entity = Gcloud::Datastore::Entity.new
189
- entity.key = Gcloud::Datastore::Key.new "Thing", 123
190
- entity["name"] = "Thing 1"
191
- value = Gcloud::Datastore::Proto::Value.new
192
- value.entity_value = entity.to_proto
193
- raw = Gcloud::Datastore::Proto.from_proto_value value
194
- assert_kind_of Gcloud::Datastore::Entity, raw
195
- refute_kind_of Gcloud::Datastore::Proto::Entity, raw
196
- # Fix up the indexed values so they can match
197
- raw_proto = raw.to_proto
198
- raw_proto.property.first.value.indexed = true
199
- entity_proto = entity.to_proto
200
- entity_proto.property.first.value.indexed = true
201
- raw_proto.must_equal entity_proto
202
- end
203
-
204
- it "encodes Array" do
205
- array = ["string", 123, true]
206
- value = Gcloud::Datastore::Proto.to_proto_value array
207
- value.list_value.wont_be :nil?
208
- value.key_value.must_be :nil?
209
- value.entity_value.must_be :nil?
210
- value.timestamp_microseconds_value.must_be :nil?
211
- value.boolean_value.must_be :nil?
212
- value.double_value.must_be :nil?
213
- value.integer_value.must_be :nil?
214
- value.string_value.must_be :nil?
215
- end
216
-
217
- it "decodes List" do
218
- value = Gcloud::Datastore::Proto::Value.new
219
- value.list_value = [
220
- Gcloud::Datastore::Proto::Value.new.tap { |v| v.string_value = "string" },
221
- Gcloud::Datastore::Proto::Value.new.tap { |v| v.integer_value = 123 },
222
- Gcloud::Datastore::Proto::Value.new.tap { |v| v.boolean_value = true },
223
- ]
224
- raw = Gcloud::Datastore::Proto.from_proto_value value
225
- assert_kind_of Array, raw
226
- raw.count.must_equal 3
227
- raw[0].must_equal "string"
228
- raw[1].must_equal 123
229
- raw[2].must_equal true
230
- end
231
- end
@@ -1,93 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "helper"
16
- require "gcloud/datastore"
17
-
18
- describe Gcloud::Datastore::Connection do
19
- let(:project) { "my-todo-project" }
20
- let(:credentials) { OpenStruct.new }
21
- let(:connection) { Gcloud::Datastore::Connection.new project, credentials }
22
- let(:http_mock) { Minitest::Mock.new }
23
- let(:mocks) { [] }
24
-
25
- before do
26
- connection.http = http_mock
27
- mocks << http_mock
28
- end
29
-
30
- it "makes an http POST for allocate_ids" do
31
- http_mock.expect :post, new_response_mock, [rpc_path("allocateIds")]
32
- key = Gcloud::Datastore::Key.new "User"
33
- response = connection.allocate_ids key.to_proto, key.to_proto, key.to_proto
34
- response.must_be_kind_of Gcloud::Datastore::Proto::AllocateIdsResponse
35
- end
36
-
37
- it "makes an http POST for lookup" do
38
- http_mock.expect :post, new_response_mock, [rpc_path("lookup")]
39
- key1 = Gcloud::Datastore::Key.new "User", "silvolu"
40
- key2 = Gcloud::Datastore::Key.new "User", "blowmage"
41
- response = connection.lookup key1.to_proto, key2.to_proto
42
- response.must_be_kind_of Gcloud::Datastore::Proto::LookupResponse
43
- end
44
-
45
- it "makes an http POST for run_query" do
46
- http_mock.expect :post, new_response_mock, [rpc_path("runQuery")]
47
- query = Gcloud::Datastore::Query.new.kind("User")
48
- response = connection.run_query query.to_proto
49
- response.must_be_kind_of Gcloud::Datastore::Proto::RunQueryResponse
50
- end
51
-
52
- it "makes an http POST for begin_transaction" do
53
- http_mock.expect :post, new_response_mock, [rpc_path("beginTransaction")]
54
- response = connection.begin_transaction
55
- response.must_be_kind_of Gcloud::Datastore::Proto::BeginTransactionResponse
56
- end
57
-
58
- it "makes an http POST for commit" do
59
- http_mock.expect :post, new_response_mock, [rpc_path("commit")]
60
- mutation_proto = Gcloud::Datastore::Proto::Mutation.new
61
- response = connection.commit mutation_proto
62
- response.must_be_kind_of Gcloud::Datastore::Proto::CommitResponse
63
- end
64
-
65
- it "makes an http POST for commit with transaction" do
66
- http_mock.expect :post, new_response_mock, [rpc_path("commit")]
67
- mutation_proto = Gcloud::Datastore::Proto::Mutation.new
68
- response = connection.commit mutation_proto, "transaction123456"
69
- response.must_be_kind_of Gcloud::Datastore::Proto::CommitResponse
70
- end
71
-
72
- it "makes an http POST for rollback" do
73
- http_mock.expect :post, new_response_mock, [rpc_path("rollback")]
74
- response = connection.rollback "transaction123456"
75
- response.must_be_kind_of Gcloud::Datastore::Proto::RollbackResponse
76
- end
77
-
78
- after do
79
- mocks.each { |mock| mock.verify }
80
- end
81
-
82
- def rpc_path method
83
- connection.send :rpc_path, method
84
- end
85
-
86
- def new_response_mock
87
- response_mock = Minitest::Mock.new
88
- response_mock.expect :success?, true
89
- response_mock.expect :body, ""
90
- mocks << response_mock
91
- response_mock
92
- end
93
- end