Skip to content
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

Exclude external versions from get_latest_build #5901

Merged
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/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def get_latest_build(self, finished=True):
kwargs = {'type': 'html'}
if finished:
kwargs['state'] = 'finished'
return self.builds.filter(**kwargs).first()
return self.builds(manager=INTERNAL).filter(**kwargs).first()

def api_versions(self):
from readthedocs.builds.models import APIVersion
Expand Down
14 changes: 10 additions & 4 deletions readthedocs/rtd_tests/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,23 @@ def test_all_active_versions_excludes_external_versions(self):
self.assertNotIn(self.external_version, self.pip.all_active_versions())

def test_update_stable_version_excludes_external_versions(self):
# Delete all versions excluding PR Versions.
# Delete all versions excluding External Versions.
self.pip.versions.exclude(type=EXTERNAL).delete()
# Test that PR Version is not considered for stable.
# Test that External Version is not considered for stable.
self.assertEqual(self.pip.update_stable_version(), None)

def test_has_good_build_excludes_external_versions(self):
# Delete all versions excluding PR Versions.
# Delete all versions excluding External Versions.
self.pip.versions.exclude(type=EXTERNAL).delete()
# Test that PR Version is not considered for has_good_build.
# Test that External Version is not considered for has_good_build.
self.assertFalse(self.pip.has_good_build)

def test_get_latest_build_excludes_external_versions(self):
# Delete all versions excluding External Versions.
self.pip.versions.exclude(type=EXTERNAL).delete()
# Test that External Version is not considered for get_latest_build.
self.assertEqual(self.pip.get_latest_build(), None)


class TestProjectTranslations(ProjectMixin, TestCase):

Expand Down