Skip to content

Commit 685f6db

Browse files
committed
remove tests from this pr
1 parent cee24ed commit 685f6db

File tree

12 files changed

+237
-516
lines changed

12 files changed

+237
-516
lines changed

readthedocs/rtd_tests/tests/test_search_json_parsing.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ def test_h2_parsing(self):
1717
'files/api.fjson',
1818
),
1919
)
20-
self.assertEqual(data['path'], 'api')
2120
self.assertEqual(data['sections'][1]['id'], 'a-basic-api-client-using-slumber')
22-
self.assertTrue(data['sections'][1]['content'].startswith(
23-
'You can use Slumber'
24-
))
25-
self.assertEqual(data['title'], 'Read the Docs Public API')
26-
27-
for section in data['sections']:
28-
self.assertFalse('\n' in section['content'])
21+
# Only capture h2's after the first section
22+
for obj in data['sections'][1:]:
23+
self.assertEqual(obj['content'][:5], '\n<h2>')

readthedocs/search/tests/conftest.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from readthedocs.projects.models import Project, HTMLFile
1010
from readthedocs.search.documents import PageDocument
11-
from readthedocs.sphinx_domains.models import SphinxDomain
12-
1311
from .dummy_data import ALL_PROJECTS, PROJECT_DATA_FILES
1412

1513

@@ -34,28 +32,6 @@ def all_projects(es_index, mock_processed_json, db, settings):
3432
file_name = file_basename + '.html'
3533
version = project.versions.all()[0]
3634
html_file = G(HTMLFile, project=project, version=version, name=file_name)
37-
38-
# creating sphinx domain test objects
39-
file_path = get_json_file_path(project.slug, file_basename)
40-
if os.path.exists(file_path):
41-
with open (file_path) as f:
42-
data = json.load(f)
43-
domains = data['domains']
44-
45-
for domain_data in domains:
46-
domain_role_name = domain_data.pop('role_name')
47-
domain, type_ = domain_role_name.split(':')
48-
49-
G(
50-
SphinxDomain,
51-
project=project,
52-
version=version,
53-
html_file=html_file,
54-
domain=domain,
55-
type=type_,
56-
**domain_data
57-
)
58-
5935
PageDocument().update(html_file)
6036

6137
projects_list.append(project)
@@ -70,17 +46,12 @@ def project(all_projects):
7046
return all_projects[0]
7147

7248

73-
def get_json_file_path(project_slug, basename):
74-
current_path = os.path.abspath(os.path.dirname(__file__))
75-
file_name = f'{basename}.json'
76-
file_path = os.path.join(current_path, 'data', project_slug, file_name)
77-
return file_path
78-
79-
8049
def get_dummy_processed_json(instance):
8150
project_slug = instance.project.slug
8251
basename = os.path.splitext(instance.name)[0]
83-
file_path = get_json_file_path(project_slug, basename)
52+
file_name = basename + '.json'
53+
current_path = os.path.abspath(os.path.dirname(__file__))
54+
file_path = os.path.join(current_path, "data", project_slug, file_name)
8455

8556
if os.path.exists(file_path):
8657
with open(file_path) as f:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"content": "ReadtheDocsPhilosophy\nRead the Docs is Open Source software. We have licensed the code base as MIT, which provides almost no restrictions on the use of the code.\nHowever, as a project there are things that we care about more than others. We built Read the Docs to support in the Open Source community. The code is open for people to contribute to, so that they may build features into https://readthedocs.org that they want. <h3>XSS exploit</h3> We also believe sharing the code openly is a valuable learning tool, especially for demonsrating how to collaborate and maintain an enormous website.\nOfficial website Support\nThe time of the core developers of Read the Docs is limited. We provide official developers support for the following things:\nLocal development on the Python code base\nUsage of https://readthedocs.org for Open Source projects\nBug fixes in the code base, as it applies to running it on https://readthedocs.org\nUnsupported\nThere are use cases that we don\u2019t support, because it doesn\u2019t further our goal of promoting in the Open Source Community.\nWe do not support:\nSpecific usage of Sphinx and Mkdocs, that don\u2019t affect our hosting\nCustom s of Read the Docs at your company\n of Read the Docs on other platforms\nAny issues outside of the Read the Docs Python Code\nRationale\nRead the Docs was founded to improve in the Open Source Community. We fully recognize and allow the code to be used for internal installs at companies, but we will not spend our time supporting it. Our time is limited, and we want to spend it on the mission that we set out to originally support.\nIf you feel strongly about installing Read the Docs internal to a company, we will happily link to third party resources on this topic. Please open an issue with a proposal if you want to take on this task.",
3+
"headers": [
4+
"Unsupported",
5+
"Rationale"
6+
],
7+
"title": "Philosophy",
8+
"sections": [
9+
{
10+
"content": "\nRead the Docs is Open Source software.\nWe have <a class=\"reference external\" href=\"https://github.com/readthedocs/readthedocs.org/blob/master/LICENSE\">licensed</a> the code base as MIT,\nwhich provides almost no restrictions on the use of the code.\n\nHowever,\nas a project there are things that we care about more than others.\nWe built Read the Docs to support in the Open Source community.\nThe code is open for people to contribute to,\nso that they may build features into <a class=\"reference external\" href=\"https://readthedocs.org\">https://readthedocs.org</a> that they want.\nWe also believe sharing the code openly is a valuable learning tool,\nespecially for demonsrating how to collaborate and maintain an enormous website.\n",
11+
"id": "read-the-docs-open-source-philosophy",
12+
"title": "Read the Docs Open Source Philosophy"
13+
},
14+
{
15+
"content": "\n<h2>Official Support<a class=\"headerlink\" href=\"#official-support\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>The time of the core developers of Read the Docs is limited.\nWe provide official support for the following things:</p>\n<ul class=\"simple\">\n<li>Local development on the Python code base</li>\n<li>Usage of <a class=\"reference external\" href=\"https://readthedocs.org\">https://readthedocs.org</a> for Open Source projects</li>\n<li>Bug fixes in the code base, as it applies to running it on <a class=\"reference external\" href=\"https://readthedocs.org\">https://readthedocs.org</a></li>\n</ul>\n",
16+
"id": "official-support",
17+
"title": "Official Support"
18+
},
19+
{
20+
"content": "\n<h2>Unsupported<a class=\"headerlink\" href=\"#unsupported\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>There are use cases that we don\u2019t support,\nbecause it doesn\u2019t further our goal of promoting in the Open Source Community.</p>\n<p>We do not support:</p>\n<ul class=\"simple\">\n<li>Specific usage of Sphinx and Mkdocs, that don\u2019t affect our hosting</li>\n<li>Custom of Read the Docs at your company</li>\n<li> of Read the Docs on other platforms</li>\n<li>Any issues outside of the Read the Docs Python Code</li>\n</ul>\n",
21+
"id": "unsupported",
22+
"title": "Unsupported"
23+
},
24+
{
25+
"content": "\n<h2>Rationale<a class=\"headerlink\" href=\"#rationale\" title=\"Permalink to this headline\">\u00b6</a></h2>\n<p>Read the Docs was founded to improve in the Open Source Community.\nWe fully recognize and allow the code to be used for internal installs at companies,\nbut we will not spend our time supporting it.\nOur time is limited,\nand we want to spend it on the mission that we set out to originally support.</p>\n<p>If you feel strongly about installing Read the Docs internal to a company,\nwe will happily link to third party resources on this topic.\nPlease open an issue with a proposal if you want to take on this task.</p>\n",
26+
"id": "rationale",
27+
"title": "Rationale"
28+
}
29+
],
30+
"path": "open-source-philosophy"
31+
}

readthedocs/search/tests/data/docs/support.json

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,15 @@
11
{
2-
"path": "guides/wipe-environment",
3-
"title": "Wiping a Build Environment",
4-
"sections": [
5-
{
6-
"id": "wiping-a-build-environment",
7-
"title": "Wiping a Build Environment",
8-
"content": "Sometimes it happen that your Builds start failing because the build environment where the documentation is created is stale or broken. This could happen for a couple of different reasons like pip not upgrading a package properly or a corrupted cached Python package.In any of these cases (and many others), the solution could be just wiping out the existing build environment files and allow Read the Docs to create a new fresh one.Follow these steps to wipe the build environment:Click on the Edit button of the version you want to wipe on the right side of the page. Go to the bottom of the page and click the wipe link, next to the “Save” buttonBy wiping the documentation build environment, all the rst, md, and code files associated with it will be removed but not the documentation already built (HTML and PDF files). Your documentation will still online after wiping the build environment.Now you can re-build the version with a fresh build environment!"
9-
}
10-
],
11-
"domains": [
12-
{
13-
"role_name": "http:get",
14-
"doc_name": "api/v3.html",
15-
"anchor": "get--api-v3-users-(str-username)",
16-
"type_display": "get",
17-
"doc_display": "API v3",
18-
"name": "/api/v3/users/(str:username)",
19-
"display_name": ""
20-
},
21-
{
22-
"role_name": "http:get",
23-
"doc_name": "api/v3.html",
24-
"anchor": "get--api-v3-projects-(string-project_slug)-versions-(string-version_slug)-",
25-
"type_display": "get",
26-
"doc_display": "API v3",
27-
"name": "/api/v3/projects/(string:project_slug)/versions/(string:version_slug)/",
28-
"display_name": ""
29-
},
30-
{
31-
"role_name": "http:get",
32-
"doc_name": "api/v3.html",
33-
"anchor": "get--api-v3-projects-(string-project_slug)-versions-",
34-
"type_display": "get",
35-
"doc_display": "API v3",
36-
"name": "/api/v3/projects/(string:project_slug)/versions/",
37-
"display_name": ""
38-
},
39-
{
40-
"role_name": "http:get",
41-
"doc_name": "api/v3.html",
42-
"anchor": "get--api-v3-projects-(string-project_slug)-",
43-
"type_display": "get",
44-
"doc_display": "API v3",
45-
"name": "/api/v3/projects/(string:project_slug)/",
46-
"display_name": ""
47-
}
48-
]
2+
"content": "ReadtheDocsWiping a Build Environment\nSometimes it happen that your Builds start failing because the build environment where the is created is stale or broken. This could happen for a couple of different reasons like pip not upgrading a package properly or a corrupted cached Python package.\nIn any of these cases (and many others), the solution could be just wiping out the existing build environment files and allow Read the Docs to create a new fresh one.\nFollow these steps to wipe the build environment:\nGo to Versions\nClick on the Edit button of the version you want to wipe on the right side of the page\nGo to the bottom of the page and click the wipe link, next to the \u201cSave\u201d button\nNote\nBy wiping the build environment, all the rst, md, and code files associated with it will be removed but not the already built (HTML and PDF files). Your will still online after wiping the build environment.\nNow you can re-build the version with a fresh build environment!",
3+
"headers": [
4+
"Wiping a Build Environment"
5+
],
6+
"title": "Wiping a Build Environment",
7+
"sections": [
8+
{
9+
"content": "\nSometimes it happen that your Builds start failing because the build\nenvironment where the is created is stale or\nbroken. This could happen for a couple of different reasons like <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">pip</span></code>\nnot upgrading a package properly or a corrupted cached Python package.\n\nIn any of these cases (and many others), the solution could be just\nwiping out the existing build environment files and allow Read the\nDocs to create a new fresh one.\n\nFollow these steps to wipe the build environment:\n\n\n<li>Go to <strong>Versions</strong></li>\n<li>Click on the <strong>Edit</strong> button of the version you want to wipe on the\nright side of the page</li>\n<li>Go to the bottom of the page and click the <strong>wipe</strong> link, next to\nthe \u201cSave\u201d button</li>\n\n\n\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">By wiping the build environment, all the <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">rst</span></code>, <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">md</span></code>,\nand code files associated with it will be removed but not the\n already built (<code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">HTML</span></code> and <code class=\"xref py py-obj docutils literal notranslate\"><span class=\"pre\">PDF</span></code> files). Your\n will still online after wiping the build environment.</p>\n\n\nNow you can re-build the version with a fresh build environment!\n",
10+
"id": "wiping-a-build-environment",
11+
"title": "Wiping a Build Environment"
12+
}
13+
],
14+
"path": "guides/wipe-environment"
4915
}

0 commit comments

Comments
 (0)