'refresh_nodes_and_tokens uses preloaded results if given for shared table queries'

def test_refresh_nodes_and_tokens_uses_preloaded_results_if_given(self):

    preloaded_results = self._get_matching_schema_preloaded_results()
    self.control_connection._refresh_node_list_and_token_map(self.connection, preloaded_results=preloaded_results)
    meta = self.cluster.metadata
    self.assertEqual(meta.partitioner, 'Murmur3Partitioner')
    self.assertEqual(meta.cluster_name, 'foocluster')
    self.assertEqual(sorted(meta.all_hosts()), sorted(meta.token_map.keys()))
    for token_list in meta.token_map.values():
        self.assertEqual(3, len(token_list))
    for host in meta.all_hosts():
        self.assertEqual(host.datacenter, 'dc1')
        self.assertEqual(host.rack, 'rack1')
    self.assertEqual(self.connection.wait_for_responses.call_count, 0)
