Fix tests: replace parse_subpages with `single-page

This commit is contained in:
Alexey Leshchenko 2022-02-18 14:16:30 +03:00
parent 55c978fd7b
commit 8a2c230f90
2 changed files with 4 additions and 7 deletions

View File

@ -243,13 +243,12 @@ class Parser:
options=chrome_options,
)
def parse_page(self, url: str, index: str = None, parse_subpages=True):
def parse_page(self, url: str, index: str = None):
"""Parse page at url and write it to file, then recursively parse all subpages.
Args:
url (str): URL of the page to parse.
index (str, optional): URL of the index page. Defaults to None.
parse_subpages (bool): if subpages should be parsed. Used for testing.
After the page at `url` has been parsed, calls itself recursively for every subpage
it has discovered.
@ -297,8 +296,6 @@ class Parser:
subpages = self.find_subpages(url, index, soup, hrefDomain)
self.export_parsed_page(url, index, soup)
if parse_subpages:
self.parse_subpages(index, subpages)
def load_correct_theme(self, url):

View File

@ -3,10 +3,10 @@ from loconotion.notionparser import Parser
def test_parse_sample_page():
config={"page": "https://www.notion.so/Loconotion-Example-Page-03c403f4fdc94cc1b315b9469a8950ef"}
args = {"timeout": 10}
args = {"timeout": 10, "single_page": True}
parser = Parser(config, args)
parser.processed_pages = {}
parser.parse_page(parser.starting_url, parse_subpages=False)
parser.parse_page(parser.starting_url)
assert parser.starting_url in parser.processed_pages