def test_idNotSetButEnclosureIsUsed(self): guid = "http://example.com/podcast/episode1.mp3" episode = Episode() episode.title = "My first episode" episode.media = Media(guid, 97423487, "audio/mpeg") item = episode.rss_entry() assert item.find("guid").text == guid
def test_idIsSet(self): guid = "http://example.com/podcast/episode1" episode = Episode() episode.title = "My first episode" episode.id = guid item = episode.rss_entry() assert item.find("guid").text == guid
def test_idSetToFalseSoEnclosureNotUsed(self): episode = Episode() episode.title = "My first episode" episode.media = Media("http://example.com/podcast/episode1.mp3", 34328731, "audio/mpeg") episode.id = False item = episode.rss_entry() assert item.find("guid") is None
def test_mandatoryAttributes(self): ep = Episode() self.assertRaises((RuntimeError, ValueError), ep.rss_entry) ep.title = "A title" ep.rss_entry() ep.title = "" self.assertRaises((RuntimeError, ValueError), ep.rss_entry) ep.title = None self.assertRaises((RuntimeError, ValueError), ep.rss_entry) ep.summary = "A summary" ep.rss_entry() ep.summary = "" self.assertRaises((RuntimeError, ValueError), ep.rss_entry) ep.summary = None self.assertRaises((RuntimeError, ValueError), ep.rss_entry)