1515
1616import unittest
1717
18+ import mock
19+
1820
1921class TestCluster (unittest .TestCase ):
2022
@@ -232,7 +234,7 @@ def test_reload(self):
232234
233235 def test_create (self ):
234236 from google .longrunning import operations_pb2
235- from google .cloud .operation import Operation
237+ from google .cloud .future import operation
236238 from google .cloud .bigtable ._generated import (
237239 bigtable_instance_admin_pb2 as messages_v2_pb2 )
238240 from tests .unit ._testing import _FakeStub
@@ -256,13 +258,9 @@ def test_create(self):
256258 # Perform the method and check the result.
257259 result = cluster .create ()
258260
259- self .assertIsInstance (result , Operation )
260- self .assertEqual (result .name , OP_NAME )
261- self .assertIs (result .target , cluster )
262- self .assertIs (result .client , client )
261+ self .assertIsInstance (result , operation .Operation )
262+ self .assertEqual (result .operation .name , OP_NAME )
263263 self .assertIsNone (result .metadata )
264- self .assertEqual (result .caller_metadata ,
265- {'request_type' : 'CreateCluster' })
266264
267265 self .assertEqual (len (stub .method_calls ), 1 )
268266 api_name , args , kwargs = stub .method_calls [0 ]
@@ -278,7 +276,7 @@ def test_create(self):
278276 def test_update (self ):
279277 import datetime
280278 from google .longrunning import operations_pb2
281- from google .cloud .operation import Operation
279+ from google .cloud .future import operation
282280 from google .protobuf .any_pb2 import Any
283281 from google .cloud ._helpers import _datetime_to_pb_timestamp
284282 from google .cloud .bigtable ._generated import (
@@ -324,15 +322,11 @@ def test_update(self):
324322
325323 result = cluster .update ()
326324
327- self .assertIsInstance (result , Operation )
328- self .assertEqual (result .name , OP_NAME )
329- self .assertIs (result .target , cluster )
330- self .assertIs (result .client , client )
325+ self .assertIsInstance (result , operation .Operation )
326+ self .assertEqual (result .operation .name , OP_NAME )
331327 self .assertIsInstance (result .metadata ,
332328 messages_v2_pb2 .UpdateClusterMetadata )
333329 self .assertEqual (result .metadata .request_time , NOW_PB )
334- self .assertEqual (result .caller_metadata ,
335- {'request_type' : 'UpdateCluster' })
336330
337331 self .assertEqual (len (stub .method_calls ), 1 )
338332 api_name , args , kwargs = stub .method_calls [0 ]
@@ -448,6 +442,7 @@ class _Client(object):
448442 def __init__ (self , project ):
449443 self .project = project
450444 self .project_name = 'projects/' + self .project
445+ self ._operations_stub = mock .sentinel .operations_stub
451446
452447 def __eq__ (self , other ):
453448 return (other .project == self .project and
0 commit comments