@@ -576,7 +576,7 @@ def test_wrap_round_robin(self):
576576 cluster = Mock (spec = Cluster )
577577 cluster .metadata = Mock (spec = Metadata )
578578 cluster .metadata ._tablets = Mock (spec = Tablets )
579- cluster .metadata ._tablets .table_has_tablets .return_value = []
579+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
580580 hosts = [Host (DefaultEndPoint (str (i )), SimpleConvictionPolicy , host_id = uuid .uuid4 ()) for i in range (4 )]
581581 for host in hosts :
582582 host .set_up ()
@@ -609,7 +609,7 @@ def test_wrap_dc_aware(self):
609609 cluster = Mock (spec = Cluster )
610610 cluster .metadata = Mock (spec = Metadata )
611611 cluster .metadata ._tablets = Mock (spec = Tablets )
612- cluster .metadata ._tablets .table_has_tablets .return_value = []
612+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
613613 hosts = [Host (DefaultEndPoint (str (i )), SimpleConvictionPolicy , host_id = uuid .uuid4 ()) for i in range (4 )]
614614 for host in hosts :
615615 host .set_up ()
@@ -658,7 +658,7 @@ def test_wrap_rack_aware(self):
658658 cluster = Mock (spec = Cluster )
659659 cluster .metadata = Mock (spec = Metadata )
660660 cluster .metadata ._tablets = Mock (spec = Tablets )
661- cluster .metadata ._tablets .table_has_tablets .return_value = []
661+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
662662 hosts = [Host (DefaultEndPoint (str (i )), SimpleConvictionPolicy , host_id = uuid .uuid4 ()) for i in range (8 )]
663663 for host in hosts :
664664 host .set_up ()
@@ -803,7 +803,7 @@ def test_statement_keyspace(self):
803803 cluster .metadata ._tablets = Mock (spec = Tablets )
804804 replicas = hosts [2 :]
805805 cluster .metadata .get_replicas .return_value = replicas
806- cluster .metadata ._tablets .table_has_tablets .return_value = []
806+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
807807
808808 child_policy = Mock ()
809809 child_policy .make_query_plan .return_value = hosts
@@ -896,7 +896,7 @@ def _prepare_cluster_with_vnodes(self):
896896 cluster .metadata ._tablets = Mock (spec = Tablets )
897897 cluster .metadata .all_hosts .return_value = hosts
898898 cluster .metadata .get_replicas .return_value = hosts [2 :]
899- cluster .metadata ._tablets .table_has_tablets .return_value = False
899+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
900900 return cluster
901901
902902 def _prepare_cluster_with_tablets (self ):
@@ -908,7 +908,6 @@ def _prepare_cluster_with_tablets(self):
908908 cluster .metadata ._tablets = Mock (spec = Tablets )
909909 cluster .metadata .all_hosts .return_value = hosts
910910 cluster .metadata .get_replicas .return_value = hosts [2 :]
911- cluster .metadata ._tablets .table_has_tablets .return_value = True
912911 cluster .metadata ._tablets .get_tablet_for_key .return_value = Tablet (replicas = [(h .host_id , 0 ) for h in hosts [2 :]])
913912 return cluster
914913
@@ -923,7 +922,7 @@ def _assert_shuffle(self, patched_shuffle, cluster, keyspace, routing_key):
923922 policy = TokenAwarePolicy (child_policy , shuffle_replicas = True )
924923 policy .populate (cluster , hosts )
925924
926- is_tablets = cluster .metadata ._tablets .table_has_tablets ()
925+ is_tablets = cluster .metadata ._tablets .get_tablet_for_key () is not None
927926
928927 cluster .metadata .get_replicas .reset_mock ()
929928 child_policy .make_query_plan .reset_mock ()
@@ -1630,7 +1629,7 @@ def get_replicas(keyspace, packed_key):
16301629
16311630 cluster .metadata .get_replicas .side_effect = get_replicas
16321631 cluster .metadata ._tablets = Mock (spec = Tablets )
1633- cluster .metadata ._tablets .table_has_tablets .return_value = []
1632+ cluster .metadata ._tablets .get_tablet_for_key .return_value = None
16341633
16351634 child_policy = TokenAwarePolicy (RoundRobinPolicy ())
16361635
0 commit comments