Esempio n. 1
0
    def test_as_dict(self):
        subject = Story(
            title="My Great Story",
            author="Great Author",
            summary="My Great Summary",
            chapters=[5, 5, 5],
        )

        assert subject.as_dict() == {
            "title": "My Great Story",
            "author": "Great Author",
            "summary": "My Great Summary",
            "chapters": [5, 5, 5],
            "date_fetched": datetime(2000, 1, 1).timestamp(),
        }
Esempio n. 2
0
 def fetch_story(self):
     return Story(
         title=self.story_index.title,
         author=self.story_index.author,
         summary=self.story_index.summary,
         chapters=[ch.as_chapter() for ch in self.fetch_chapters()],
     )
Esempio n. 3
0
 def fetch_story(self):
     submissions = self.fetch_submissions()
     title = config.get_fetcher_opt("title", required=True)
     author = submissions[0].author_name
     return Story(
         title=title,
         author=author,
         chapters=[subm.as_chapter() for subm in submissions],
     )
Esempio n. 4
0
 def fetch_story(self):
     title = config.get_fetcher_opt("title", required=True)
     entries = list(self.fetch_blog_entries())
     author = entries[0].author
     return Story(
         title=title,
         author=author,
         summary="",
         chapters=[entry.as_chapter() for entry in entries],
     )
Esempio n. 5
0
 def fetch_story(self):
     ffn_chapters = self.fetch_chapters()
     title = ffn_chapters[0].story_title
     author = ffn_chapters[0].author_name
     return Story(
         title=title,
         author=author,
         summary=ffn_chapters[0].summary,
         chapters=[ch.as_chapter() for ch in ffn_chapters],
     )
Esempio n. 6
0
 def fetch_story(self):
     title = (
         config.get_fetcher_opt("title", required=True)
         + " ("
         + ", ".join(self.categories_to_fetch)
         + ")"
     )
     posts = list(self.fetch_posts())
     author = posts[0].author
     return Story(
         title=title,
         author=author,
         summary="",  # TODO some threads have summaries
         chapters=[entry.as_chapter() for entry in posts],
     )
Esempio n. 7
0
    def test_from_dict(self):
        input_dict = {
            "title": "My Great Story",
            "author": "Great Author",
            "summary": "My Great Summary",
            "chapters": [5, 5, 5],
            "date_fetched": "today!",
        }

        subject = Story.from_dict(input_dict)

        assert subject.title == "My Great Story"
        assert subject.author == "Great Author"
        assert subject.summary == "My Great Summary"
        assert subject.chapters == [5, 5, 5]
        assert subject.date_fetched == "today!"
Esempio n. 8
0
    def test_id(self, chapter_factory):
        chapters = build_three_chapters(chapter_factory)
        subject = Story(chapters=chapters)

        assert subject.id == "5permalink+for+chapter+0"
Esempio n. 9
0
    def test_date_end(self, chapter_factory):
        subject = Story(chapters=build_three_chapters(chapter_factory))

        assert subject.date_end == 8