|
3 | 3 | import sys
|
4 | 4 |
|
5 | 5 | import pytest
|
6 |
| -from django.urls.base import set_urlconf, get_urlconf |
7 | 6 | from django.test import TestCase
|
8 | 7 | from django.test.utils import override_settings
|
| 8 | +from django.urls.base import get_urlconf, set_urlconf |
9 | 9 | from django_dynamic_fixture import get
|
10 | 10 |
|
| 11 | +from readthedocs.builds.models import Version |
| 12 | +from readthedocs.projects.constants import PUBLIC |
11 | 13 | from readthedocs.projects.models import Domain, Project, ProjectRelationship
|
12 | 14 | from readthedocs.proxito.middleware import ProxitoMiddleware
|
13 | 15 | from readthedocs.rtd_tests.base import RequestFactoryTestMixin
|
@@ -159,9 +161,17 @@ def setUp(self):
|
159 | 161 | Project,
|
160 | 162 | slug='pip',
|
161 | 163 | users=[self.owner],
|
162 |
| - privacy_level='public', |
| 164 | + privacy_level=PUBLIC, |
163 | 165 | urlconf='subpath/to/$version/$language/$filename' # Flipped
|
164 | 166 | )
|
| 167 | + self.testing_version = get( |
| 168 | + Version, |
| 169 | + slug='testing', |
| 170 | + project=self.pip, |
| 171 | + built=True, |
| 172 | + active=True, |
| 173 | + ) |
| 174 | + self.pip.versions.update(privacy_level=PUBLIC) |
165 | 175 |
|
166 | 176 | sys.modules['fake_urlconf'] = self.pip.proxito_urlconf
|
167 | 177 | set_urlconf('fake_urlconf')
|
@@ -220,17 +230,26 @@ def setUp(self):
|
220 | 230 | name='pip',
|
221 | 231 | slug='pip',
|
222 | 232 | users=[self.owner],
|
223 |
| - privacy_level='public', |
| 233 | + privacy_level=PUBLIC, |
224 | 234 | urlconf='subpath/$subproject/$version/$language/$filename' # Flipped
|
225 | 235 | )
|
| 236 | + self.testing_version = get( |
| 237 | + Version, |
| 238 | + slug='testing', |
| 239 | + project=self.pip, |
| 240 | + built=True, |
| 241 | + active=True, |
| 242 | + ) |
| 243 | + self.pip.versions.update(privacy_level=PUBLIC) |
226 | 244 | self.subproject = get(
|
227 | 245 | Project,
|
228 | 246 | name='subproject',
|
229 | 247 | slug='subproject',
|
230 | 248 | users=[self.owner],
|
231 |
| - privacy_level='public', |
| 249 | + privacy_level=PUBLIC, |
232 | 250 | main_language_project=None,
|
233 | 251 | )
|
| 252 | + self.subproject.versions.update(privacy_level=PUBLIC) |
234 | 253 | self.relationship = get(
|
235 | 254 | ProjectRelationship,
|
236 | 255 | parent=self.pip,
|
|
0 commit comments