Improvements for bootstrapping mock client with torrents

If you add torrents when creating the mock client object, the ids
are now added automatically, using consecutive ids starting from 1.
Break out some of the listing logic to module

This is to make it easier to unit test.