def test_parse(self): generator = mock.Mock(link_pr=True) parser = GithubLinesParser(generator, self.title) pr = mock.Mock(number=1, html_url="http://pr", body="# {}\r\n\r\nfoo".format(self.title)) parser.parse(pr) self.assertEqual(1, parser.pr_number) self.assertEqual("http://pr", parser.pr_url) self.assertEqual(["foo [[PR1](http://pr)]"], parser.content)
def test_parse(self): generator = mock.Mock(link_pr=True) parser = GithubLinesParser(generator, self.title) pr = mock.Mock( number=1, html_url="http://pr", body="# {}\r\n\r\nfoo".format(self.title) ) parser.parse(pr) self.assertEqual(1, parser.pr_number) self.assertEqual("http://pr", parser.pr_url) self.assertEqual(["foo [[PR1](http://pr)]"], parser.content)
def _init_parsers(self): """Invoked from Super Class""" for cfg in self.parser_config: parser_class = import_global(cfg["class_path"]) self.parsers.append(parser_class(self, cfg["title"])) # Additional parser to collect developer notes above tracked headers self.parsers.append(GithubLinesParser(self, title=None)) self.parsers[-1]._in_section = True
def test_parse_empty_pull_request_body(self): generator = mock.Mock(link_pr=True) parser = GithubLinesParser(generator, self.title) pr = mock.Mock(number=1, html_url="http://pr", body=None) line_added = parser.parse(pr) assert not line_added