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