'Add a single file to a TorrentDef'

def test_add_content_file_and_copy(self):

    t = TorrentDef()
    fn = os.path.join(TESTS_DATA_DIR, self.VIDEO_FILE_NAME)
    t.add_content(fn)
    t.set_tracker(TRACKER)
    t.finalize()
    s = os.path.getsize(fn)
    metainfo = t.get_metainfo()
    self.general_check(metainfo)
    self.assertEqual(metainfo['info']['name'], self.VIDEO_FILE_NAME)
    self.assertEqual(metainfo['info']['length'], s)
    self.assertTrue(t.get_pieces())
    self.assertEqual(len(t.get_infohash()), INFOHASH_LENGTH)
    self.assertTrue(t.get_name())
    nt = TorrentDef(t.input, t.metainfo, t.infohash)
    self.assertEqual(nt.input, t.input)
    self.assertEqual(nt.metainfo, t.metainfo)
    self.assertEqual(nt.infohash, t.infohash)
    nt.remove_content('/test123')
    self.assertEqual(len(nt.input['files']), 1)
    nt.remove_content(unicode(fn))
    self.assertEqual(len(nt.input['files']), 0)
    nt.remove_content(unicode(fn))
