'Add a single dir and single file to a TorrentDef'

def test_add_content_dir_and_file(self):

    t = TorrentDef()
    dn = os.path.join(TESTS_DATA_DIR, 'contentdir')
    t.add_content(dn, 'dirintorrent')
    fn = os.path.join(TESTS_DATA_DIR, self.VIDEO_FILE_NAME)
    t.add_content(fn, os.path.join('dirintorrent', self.VIDEO_FILE_NAME))
    t.set_tracker(TRACKER)
    t.finalize()
    exps = os.path.getsize(fn)
    for f in os.listdir(dn):
        if f.startswith('.'):
            continue
        p = os.path.join(dn, f)
        exps += os.path.getsize(p)
    metainfo = t.get_metainfo()
    self.general_check(metainfo)
    self.assertEqual(metainfo['info']['name'], 'dirintorrent')
    reals = 0
    for file in metainfo['info']['files']:
        reals += file['length']
    self.assertEqual(exps, reals)
