Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
    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
Пример #5
0
    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
Пример #6
0
    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
Пример #7
0
    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)
Пример #8
0
    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)