Make the pesto first. Process the basil leaves with the garlic, pine nuts and cheese in a blender, or pound together in a pestle and mortar to give a coarse paste. Gradually add the olive oil, processing in bursts to a thick but not smooth paste. Check the seasoning.
Cook the pasta and potatoes together in a large pan of boiling water for 10 minutes, then add the beans and cook for 5 minutes more until tender. Drain and return to the pan.
Add the pesto and sardines to the pasta, toss together, then serve with the cheese.
