def setUp(self):
        self.input_path = tempfile.TemporaryDirectory()

        tmp_dir = self.input_path.name

        with open(tmp_dir + "/episode1.mp3", "wb") as f:
            f.write(b"episode_1_mp3_content")

        with open(tmp_dir + "/episode2.mp3", "wb") as f:
            f.write(b"episode_2_mp3_content")

        self.author = Author(name="John Doe", email="*****@*****.**")
        self.episode1 = Episode(
            id=1,
            title="Episode 1",
            description="Episode 1: test.",
            audio_file=tmp_dir + "/episode1.mp3",
        )
        self.episode2 = Episode(
            id=2,
            title="Episode 2",
            description="Episode 2: second test.",
            audio_file=tmp_dir + "/episode2.mp3",
        )
        self.podcast = Podcast(
            title="Test podcast",
            subtitle="Test podcast subtitle.",
            description="Test podcast description.",
            author=self.author,
            episodes=[self.episode1, self.episode2],
            base_url="https://example.com",
        )
Example #2
0
 def setUp(self):
     self.author = Author(name="John Doe", email="*****@*****.**")
     self.episode1 = Episode(
         id=1,
         title="Episode 1",
         description="Episode 1: test.",
         audio_file="episode1.mp3",
     )
     self.episode2 = Episode(
         id=2,
         title="Episode 2",
         description="Episode 2: second test.",
         audio_file="episode2.mp3",
     )
Example #3
0
    def __attrs_post_init__(self):
        podcast_config = yaml.load(self.yaml_str, Loader=yaml.Loader)

        pc = podcast_config["podcast"]

        author = Author(name=pc["author"]["name"], email=pc["author"]["email"])

        episodes = []
        id_count = 1
        for episode in pc["episodes"]:
            episodes.append(Episode(id=id_count, **episode))
            id_count += 1

        self.podcast = Podcast(
            title=pc["title"],
            subtitle=pc["subtitle"],
            description=pc["description"],
            author=author,
            episodes=episodes,
            base_url=pc["base_url"],
        )
 def setUp(self):
     self.author = Author(name="John Doe", email="*****@*****.**")
     self.episode1 = Episode(
         id=1,
         title="Episode 1",
         description="Episode 1: test.",
         audio_file="episode1.mp3",
     )
     self.episode2 = Episode(
         id=2,
         title="Episode 2",
         description="Episode 2: second test.",
         audio_file="episode2.mp3",
     )
     self.podcast = Podcast(
         title="Test podcast",
         subtitle="Test podcast subtitle.",
         description="Test podcast description.",
         author=self.author,
         episodes=[self.episode1, self.episode2],
         base_url="https://example.com",
     )
Example #5
0
 def test_init_author(self):
     author = Author(name="John Doe", email="*****@*****.**")
     self.assertEqual(author.name, "John Doe")
     self.assertEqual(author.email, "*****@*****.**")
Example #6
0
 def test_author_to_dict(self):
     author = Author(name="John Doe", email="*****@*****.**")
     self.assertEqual(author.to_dict(), {
         "name": "John Doe",
         "email": "*****@*****.**"
     })