Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions readthedocs/api/v3/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ class Meta:
"external_builds_enabled",
"privacy_level",
"external_builds_privacy_level",
"readthedocs_yaml_path",
# NOTE: we do not allow to change any setting that can be set via
# the YAML config file.
)
Expand Down Expand Up @@ -794,6 +795,7 @@ class Meta:
"urls",
"tags",
"privacy_level",
"readthedocs_yaml_path",
"external_builds_privacy_level",
"versioning_scheme",
# Kept for backwards compatibility,
Expand Down
1 change: 1 addition & 0 deletions readthedocs/api/v3/tests/responses/projects-detail.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"test"
],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/project/builds/",
"documentation": "http://project.readthedocs.io/en/latest/",
Expand Down
1 change: 1 addition & 0 deletions readthedocs/api/v3/tests/responses/projects-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"default_branch": "master",
"subproject_of": null,
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/project/builds/",
"documentation": "http://project.readthedocs.io/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"subproject_of": null,
"tags": ["template tag", "test tag"],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/test-project/builds/",
"documentation": "http://test-project.readthedocs.io/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"slug": "subproject",
"tags": [],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/subproject/builds/",
"documentation": "http://project.readthedocs.io/projects/subproject/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"slug": "subproject",
"tags": [],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/subproject/builds/",
"documentation": "http://project.readthedocs.io/projects/subproject/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"slug": "new-project",
"tags": [],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/new-project/builds/",
"documentation": "http://project.readthedocs.io/projects/subproject-alias/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"test"
],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/project/builds/",
"documentation": "http://project.readthedocs.io/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"test"
],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/project/builds/",
"documentation": "http://project.readthedocs.io/en/latest/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"subproject_of": null,
"tags": ["project", "tag", "test"],
"translation_of": null,
"readthedocs_yaml_path": null,
"urls": {
"builds": "https://readthedocs.org/projects/project/builds/",
"documentation": "http://project.readthedocs.io/en/latest/",
Expand Down
31 changes: 31 additions & 0 deletions readthedocs/api/v3/tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,37 @@ def test_partial_update_project(self):
self.assertEqual(list(self.project.tags.names()), ["partial tags", "updated"])
self.assertNotEqual(self.project.default_version, "updated-default-branch")

def test_partial_update_project_readthedocs_yaml_path(self):
"""Test that readthedocs_yaml_path can be set via PATCH and is returned in GET."""
url = reverse(
"projects-detail",
kwargs={
"project_slug": self.project.slug,
},
)

self.client.credentials(HTTP_AUTHORIZATION=f"Token {self.token.key}")

# Verify the initial value is None
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertIsNone(response.json()["readthedocs_yaml_path"])

# Set the readthedocs_yaml_path field
yaml_path = "docs/.readthedocs.yaml"
data = {"readthedocs_yaml_path": yaml_path}
response = self.client.patch(url, data)
self.assertEqual(response.status_code, 204)

# Verify it was saved to the database
self.project.refresh_from_db()
self.assertEqual(self.project.readthedocs_yaml_path, yaml_path)

# Verify it's returned in the GET response
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()["readthedocs_yaml_path"], yaml_path)

def test_partial_update_others_project(self):
data = {
"name": "Updated name",
Expand Down
1 change: 1 addition & 0 deletions readthedocs/proxito/tests/responses/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"type": "git",
"url": "https://github.com/readthedocs/project"
},
"readthedocs_yaml_path": null,
"single_version": false,
"versioning_scheme": "multiple_versions_with_translations",
"slug": "project",
Expand Down