def test_validate_unique_service_name_success(mock_list_clusters, mock_get_service_instance_list): service_name = "service_1" mock_list_clusters.return_value = ["cluster_1"] mock_get_service_instance_list.return_value = [ (service_name, "instance_1"), (service_name, "instance_2"), (service_name, "instance_3"), ] assert validate_unique_instance_names(f"soa/{service_name}")
def test_validate_unique_service_name_success( mock_list_clusters, mock_get_service_instance_list, ): service_name = 'service_1' mock_list_clusters.return_value = ['cluster_1'] mock_get_service_instance_list.return_value = [ (service_name, 'instance_1'), (service_name, 'instance_2'), (service_name, 'instance_3'), ] assert validate_unique_instance_names(f'soa/{service_name}')
def test_validate_unique_service_name_failure(mock_list_clusters, mock_get_service_instance_list, capsys): service_name = "service_1" mock_list_clusters.return_value = ["cluster_1"] mock_get_service_instance_list.return_value = [ (service_name, "instance_1"), (service_name, "instance_2"), (service_name, "instance_1"), ] assert not validate_unique_instance_names(f"soa/{service_name}") output, _ = capsys.readouterr() assert "instance_1" in output
def test_validate_unique_service_name_failure( mock_list_clusters, mock_get_service_instance_list, capfd, ): service_name = 'service_1' mock_list_clusters.return_value = ['cluster_1'] mock_get_service_instance_list.return_value = [ (service_name, 'instance_1'), (service_name, 'instance_2'), (service_name, 'instance_1'), ] assert not validate_unique_instance_names(f'soa/{service_name}') output, _ = capfd.readouterr() assert 'instance_1' in output