Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d9a751840d
Fetching contributors…

Cannot retrieve contributors at this time

executable file 33 lines (25 sloc) 1.072 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import unittest

from gpodder import api
from config import data
from rename_downloads import rename_file


class TestRenameDownloads(unittest.TestCase):
    def setUp(self):
        self.client = api.PodcastClient()

        url = data.TEST_PODCASTS['TinFoilHat']['url']
        episodeno = data.TEST_PODCASTS['TinFoilHat']['episode']
        self.podcast = self.client.get_podcast(url)
        self.podcast_title = self.podcast.title

        self.episode = self.podcast.get_episodes()[episodeno]
        self.filename = self.episode._episode.local_filename(create=False, check_only=True)
        self.title = self.episode.title

    def tearDown(self):
        self.client._db.close()

    def test_rename_file(self):
        filename_test = os.path.join(os.environ['GPODDER_DOWNLOAD_DIR'],
            self.podcast_title, 'Pilot show.mp3')
        filename_new = rename_file(self.filename, self.title)

        self.assertEqual(filename_test, filename_new)
        self.assertNotEqual(self.filename, filename_new)
Something went wrong with that request. Please try again.