Ejemplo n.º 1
0
    def test_builder_no_comments(self):

        # Normal build
        project = ProjectFactory(allow_comments=False)
        version = project.versions.all()[0]
        builder = project.doc_builder()(version)
        self.assertEqual(builder.sphinx_builder, "readthedocs")
Ejemplo n.º 2
0
    def test_builder_no_comments(self):

        # Normal build
        project = ProjectFactory(allow_comments=False)
        version = project.versions.all()[0]
        builder = project.doc_builder()(version)
        self.assertEqual(builder.sphinx_builder, 'readthedocs')
Ejemplo n.º 3
0
    def test_build(self, mock_Popen, mock_api_versions, mock_chdir,
                   mock_apiv2_downloads):

        # subprocess mock logic

        mock_process = mock.Mock()
        process_return_dict = {'communicate.return_value': ('SOMEGITHASH', '')}
        mock_process.configure_mock(**process_return_dict)
        mock_Popen.return_value = mock_process
        mock_Popen.side_effect = build_subprocess_side_effect

        project = ProjectFactory(allow_comments=True)

        version = project.versions.all()[0]
        mock_api_versions.return_value = [version]

        mock_apiv2_downloads.get.return_value = {'downloads': "no_url_here"}

        with mock.patch('codecs.open', mock.mock_open(), create=True):
            built_docs = build_docs(
                version,
                False,
                False,
                False,
                False,
                False,
                False,
                False,
            )

        builder = project.doc_builder()(version)
        self.assertIn(builder.sphinx_builder,
                      str(mock_Popen.call_args_list[1]))
Ejemplo n.º 4
0
    def test_build(self, mock_Popen, mock_api_versions, mock_chdir, mock_apiv2_downloads):

        # subprocess mock logic

        mock_process = mock.Mock()
        process_return_dict = {'communicate.return_value': ('SOMEGITHASH', '')}
        mock_process.configure_mock(**process_return_dict)
        mock_Popen.return_value = mock_process
        mock_Popen.side_effect = build_subprocess_side_effect

        project = ProjectFactory(allow_comments=True)

        version = project.versions.all()[0]
        mock_api_versions.return_value = [version]

        mock_apiv2_downloads.get.return_value = {'downloads': "no_url_here"}

        original_exists = os.path.exists
        conf_path = os.path.join(project.checkout_path(version.slug), project.conf_py_file)

        def patched_exists(path):
            if path == conf_path:
                return True
            return original_exists(path)

        with mock.patch('codecs.open', mock.mock_open(), create=True):
            with mock.patch.object(os.path, 'exists', patched_exists):
                built_docs = build_docs(version,
                                        False,
                                        False,
                                        False,
                                        False,
                                        False,
                                        False,
                                        False,
                                        )

        builder = project.doc_builder()(version)
        self.assertIn(builder.sphinx_builder,
                      str(mock_Popen.call_args_list[1])
                      )
Ejemplo n.º 5
0
    def test_build(self, mock_Popen, mock_api_versions, mock_chdir, mock_apiv2_downloads):

        # subprocess mock logic

        mock_process = mock.Mock()
        process_return_dict = {"communicate.return_value": ("SOMEGITHASH", "")}
        mock_process.configure_mock(**process_return_dict)
        mock_Popen.return_value = mock_process
        mock_Popen.side_effect = build_subprocess_side_effect

        project = ProjectFactory(allow_comments=True)

        version = project.versions.all()[0]
        mock_api_versions.return_value = [version]

        mock_apiv2_downloads.get.return_value = {"downloads": "no_url_here"}

        with mock.patch("codecs.open", mock.mock_open(), create=True):
            built_docs = build_docs(version, False, False, False, False, False, False, False)

        builder = project.doc_builder()(version)
        self.assertIn(builder.sphinx_builder, str(mock_Popen.call_args_list[1]))