Exemplo n.º 1
0
    def test_publish_report_quiet(self):
        """Verify that we can skip publishing to stdout."""
        report = "Sample report"

        parser = osa_differ.create_parser()
        args = parser.parse_args(['HEAD~1', 'HEAD', '--quiet'])

        result = osa_differ.publish_report(report, args, 'HEAD~1', 'HEAD')

        assert result == ''
Exemplo n.º 2
0
    def test_publish_report_to_file(self, tmpdir):
        """Verify that we can write a report to a file."""
        report = "Sample report"

        p = tmpdir.mkdir('test')

        parser = osa_differ.create_parser()
        filearg = "{0}/test.rst".format(str(p))
        args = parser.parse_args(['HEAD~1', 'HEAD', '--file', filearg])

        result = osa_differ.publish_report(report, args, 'HEAD~1', 'HEAD')

        assert 'Report written to file' in result
        assert 'test.rst' in result
Exemplo n.º 3
0
    def test_publish_report_to_gist(self):
        """Verify that we can post the report to a gist."""
        json_body = {'html_url': 'https://example.com/'}
        httpretty.register_uri(httpretty.POST,
                               "https://api.github.com/gists",
                               body=json.dumps(json_body))

        report = "Sample report"

        parser = osa_differ.create_parser()
        args = parser.parse_args(['HEAD~1', 'HEAD', '--gist'])

        result = osa_differ.publish_report(report, args, 'HEAD~1', 'HEAD')

        assert 'Report posted to GitHub Gist' in result