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

More explicit setup for tests #5977

Merged
merged 3 commits into from Jul 23, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions readthedocs/rtd_tests/tests/test_project_views.py
@@ -1,4 +1,3 @@

from datetime import timedelta

from allauth.account.models import EmailAddress
Expand All @@ -12,10 +11,11 @@
from django_dynamic_fixture import get, new
from mock import patch

from readthedocs.builds.constants import LATEST, EXTERNAL
from readthedocs.builds.constants import EXTERNAL, LATEST
from readthedocs.builds.models import Build, Version
from readthedocs.oauth.models import RemoteRepository
from readthedocs.projects import tasks
from readthedocs.projects.constants import PUBLIC
from readthedocs.projects.exceptions import ProjectSpamError
from readthedocs.projects.models import Domain, Project
from readthedocs.projects.views.mixins import ProjectRelationMixin
Expand Down Expand Up @@ -390,7 +390,7 @@ def test_import_demo_imported_duplicate(self):

class TestPublicViews(MockBuildTestCase):
def setUp(self):
self.pip = get(Project, slug='pip')
self.pip = get(Project, slug='pip', privacy_level=PUBLIC)
self.external_version = get(
Version,
identifier='pr-version',
Expand Down
23 changes: 13 additions & 10 deletions readthedocs/rtd_tests/tests/test_views.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from urllib.parse import urlsplit

import mock
Expand All @@ -7,10 +6,11 @@
from django.urls import reverse
from django_dynamic_fixture import get, new

from readthedocs.builds.constants import LATEST, EXTERNAL
from readthedocs.builds.constants import EXTERNAL, LATEST
from readthedocs.builds.models import Build, Version
from readthedocs.core.permissions import AdminPermission
from readthedocs.core.models import UserProfile
from readthedocs.core.permissions import AdminPermission
from readthedocs.projects.constants import PUBLIC
from readthedocs.projects.forms import UpdateProjectForm
from readthedocs.projects.models import HTMLFile, Project

Expand Down Expand Up @@ -282,19 +282,22 @@ def test_build_redirect(self, mock):
def test_build_list_includes_external_versions(self):
external_version = get(
Version,
project = self.pip,
active = True,
type = EXTERNAL,
project=self.pip,
active=True,
type=EXTERNAL,
privacy_level=PUBLIC,
)
external_version_build = get(
Build,
project = self.pip,
version = external_version
project=self.pip,
version=external_version
)
self.pip.privacy_level = PUBLIC
self.pip.save()
response = self.client.get(
reverse('builds_project_list', args=[self.pip.slug]),
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, 200)
self.assertIn(external_version_build, response.context['build_qs'])


Expand Down Expand Up @@ -327,4 +330,4 @@ def test_projects_count(self):
response = self.client.get(self.homepage_url)

self.assertEqual(response.status_code, 200)
self.assertEqual(expected_count, response.context['projects_count'])
self.assertEqual(expected_count, response.context['projects_count'])