'Test whether the selected files are set correctly'

def test_selected_files(self):

    def mocked_set_file_prios(_):
        mocked_set_file_prios.called = True
    mocked_set_file_prios.called = False
    mocked_file = MockObject()
    mocked_file.path = 'my/path'
    mock_torrent_info = MockObject()
    mock_torrent_info.files = (lambda : [mocked_file, mocked_file])
    self.libtorrent_download_impl.handle.prioritize_files = mocked_set_file_prios
    self.libtorrent_download_impl.handle.get_torrent_info = (lambda : mock_torrent_info)
    self.libtorrent_download_impl.handle.rename_file = (lambda *_: None)
    self.libtorrent_download_impl.get_share_mode = (lambda : False)
    self.libtorrent_download_impl.tdef.get_infohash = (lambda : ('a' * 20))
    self.libtorrent_download_impl.orig_files = ['a', 'b']
    self.libtorrent_download_impl.get_save_path = (lambda : 'my/path')
    self.libtorrent_download_impl.set_selected_files(['a'])
    self.assertTrue(mocked_set_file_prios.called)
    self.libtorrent_download_impl.get_share_mode = (lambda : False)
    mocked_set_file_prios.called = False
    self.assertFalse(mocked_set_file_prios.called)
