Skip to content

Fix tests on .com #12131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion readthedocs/oauth/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def remove_webhook(self, project):
return False
return True

def remove_ssh_key(self, project):
def remove_ssh_key(self, project) -> bool:
"""
Remove the SSH key from the GitHub repository associated with the project.

Expand Down
15 changes: 15 additions & 0 deletions readthedocs/profiles/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
MESSAGE_OAUTH_WEBHOOK_NOT_REMOVED,
)
from readthedocs.oauth.services.github import GitHubService
from readthedocs.organizations.models import Organization
from readthedocs.projects.models import Project


Expand Down Expand Up @@ -175,6 +176,20 @@ def setUp(self):
repo="https://github.com/user/repo-e",
)

# Make tests work on .com.
if settings.RTD_ALLOW_ORGANIZATIONS:
self.organization = get(
Organization,
owners=[self.user],
projects=[
self.project_with_remote_repository,
self.project_with_remote_repository_no_admin,
self.project_with_remote_repository_no_member,
self.project_with_remote_organization,
self.project_without_remote_repository,
],
)

self.url = reverse("migrate_to_github_app")
self.client.force_login(self.user)

Expand Down
2 changes: 2 additions & 0 deletions readthedocs/rtd_tests/tests/test_project_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ def test_change_default_branch_from_tag_to_branch_and_vice_versa(self, trigger_b
"versioning_scheme": self.project.versioning_scheme,
"language": self.project.language,
"default_branch": branch.verbose_name,
"privacy_level": self.project.privacy_level,
"external_builds_privacy_level": self.project.external_builds_privacy_level,
}
form = UpdateProjectForm(data, instance=self.project)
assert form.is_valid()
Expand Down