Skip to content

Commit

Permalink
naming update
Browse files Browse the repository at this point in the history
  • Loading branch information
saadmk11 committed Jun 18, 2019
1 parent 1173718 commit 5a05b6c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions readthedocs/rtd_tests/tests/test_doc_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_sitemap_xml(self):
active=True
)
# This is a EXTERNAL Version
pr_version = fixture.get(
external_version = fixture.get(
Version,
identifier='pr-version',
verbose_name='pr-version',
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_sitemap_xml(self):
self.assertNotContains(
response,
self.public.get_docs_url(
version_slug=pr_version.slug,
version_slug=external_version.slug,
lang_slug=self.public.language,
private=True,
),
Expand Down
34 changes: 17 additions & 17 deletions readthedocs/rtd_tests/tests/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ def setUp(self):
self.client.login(username='test_user', password='test')
self.pip = Project.objects.get(slug='pip')
# Create a External Version. ie: pull/merge request Version.
self.public_pr_version = get(
self.public_external_version = get(
Version,
project=self.pip,
active=True,
type=EXTERNAL,
privacy_level=PUBLIC
)
self.private_pr_version = get(
self.private_external_version = get(
Version,
project=self.pip,
active=True,
type=EXTERNAL,
privacy_level=PRIVATE
)
self.protected_pr_version = get(
self.protected_external_version = get(
Version,
project=self.pip,
active=True,
Expand All @@ -54,28 +54,28 @@ class TestInternalVersionManager(TestVersionManagerBase):
"""

def test_internal_version_manager_with_all(self):
self.assertNotIn(self.public_pr_version, Version.internal.all())
self.assertNotIn(self.public_external_version, Version.internal.all())

def test_internal_version_manager_with_public(self):
self.assertNotIn(self.public_pr_version, Version.internal.public())
self.assertNotIn(self.public_external_version, Version.internal.public())

def test_internal_version_manager_with_public_with_user_and_project(self):
self.assertNotIn(
self.public_pr_version,
self.public_external_version,
Version.internal.public(self.user, self.pip)
)

def test_internal_version_manager_with_protected(self):
self.assertNotIn(self.protected_pr_version, Version.internal.protected())
self.assertNotIn(self.protected_external_version, Version.internal.protected())

def test_internal_version_manager_with_private(self):
self.assertNotIn(self.private_pr_version, Version.internal.private())
self.assertNotIn(self.private_external_version, Version.internal.private())

def test_internal_version_manager_with_api(self):
self.assertNotIn(self.public_pr_version, Version.internal.api())
self.assertNotIn(self.public_external_version, Version.internal.api())

def test_internal_version_manager_with_for_project(self):
self.assertNotIn(self.public_pr_version, Version.internal.for_project(self.pip))
self.assertNotIn(self.public_external_version, Version.internal.for_project(self.pip))


class TestExternalVersionManager(TestVersionManagerBase):
Expand All @@ -88,38 +88,38 @@ class TestExternalVersionManager(TestVersionManagerBase):

def test_external_version_manager_with_all(self):
self.assertNotIn(self.internal_versions, Version.external.all())
self.assertIn(self.public_pr_version, Version.external.all())
self.assertIn(self.public_external_version, Version.external.all())

def test_external_version_manager_with_public(self):
self.assertNotIn(self.internal_versions, Version.external.public())
self.assertIn(self.public_pr_version, Version.external.public())
self.assertIn(self.public_external_version, Version.external.public())

def test_external_version_manager_with_public_with_user_and_project(self):
self.assertNotIn(
self.internal_versions,
Version.external.public(self.user, self.pip)
)
self.assertIn(
self.public_pr_version,
self.public_external_version,
Version.external.public(self.user, self.pip)
)

def test_external_version_manager_with_protected(self):
self.assertNotIn(self.internal_versions, Version.external.protected())
self.assertIn(self.protected_pr_version, Version.external.protected())
self.assertIn(self.protected_external_version, Version.external.protected())

def test_external_version_manager_with_private(self):
self.assertNotIn(self.internal_versions, Version.external.private())
self.assertIn(self.private_pr_version, Version.external.private())
self.assertIn(self.private_external_version, Version.external.private())

def test_external_version_manager_with_api(self):
self.assertNotIn(self.internal_versions, Version.external.api())
self.assertIn(self.public_pr_version, Version.external.api())
self.assertIn(self.public_external_version, Version.external.api())

def test_external_version_manager_with_for_project(self):
self.assertNotIn(
self.internal_versions, Version.external.for_project(self.pip)
)
self.assertIn(
self.public_pr_version, Version.external.for_project(self.pip)
self.public_external_version, Version.external.for_project(self.pip)
)
16 changes: 8 additions & 8 deletions readthedocs/rtd_tests/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
self.client.login(username='eric', password='test')
self.pip = Project.objects.get(slug='pip')
# Create a External Version. ie: pull/merge request Version.
self.pr_version = get(
self.external_version = get(
Version,
identifier='pr-version',
verbose_name='pr-version',
Expand Down Expand Up @@ -145,16 +145,16 @@ def test_get_storage_path(self):
'htmlzip/pip/latest/pip.zip',
)

def test_ordered_active_versions_excludes_pr_versions(self):
self.assertNotIn(self.pr_version, self.pip.ordered_active_versions())
def test_ordered_active_versions_excludes_external_versions(self):
self.assertNotIn(self.external_version, self.pip.ordered_active_versions())

def test_active_versions_excludes_pr_versions(self):
self.assertNotIn(self.pr_version, self.pip.active_versions())
def test_active_versions_excludes_external_versions(self):
self.assertNotIn(self.external_version, self.pip.active_versions())

def test_all_active_versions_excludes_pr_versions(self):
self.assertNotIn(self.pr_version, self.pip.all_active_versions())
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_pr_versions(self):
def test_update_stable_version_excludes_external_versions(self):
# Delete all versions excluding PR Versions.
self.pip.versions.exclude(type=EXTERNAL).delete()
# Test that PR Version is not considered for stable.
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/rtd_tests/tests/test_project_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def test_commit_name_not_in_default_branch_choices(self):
'default_branch'].widget.choices],
)

def test_pr_version_not_in_default_branch_choices(self):
pr_version = get(
def test_external_version_not_in_default_branch_choices(self):
external_version = get(
Version,
identifier='pr-version',
verbose_name='pr-version',
Expand All @@ -397,7 +397,7 @@ def test_pr_version_not_in_default_branch_choices(self):
form = ProjectAdvancedForm(instance=self.project)

self.assertNotIn(
pr_version.verbose_name,
external_version.verbose_name,
[identifier for identifier, _ in form.fields[
'default_branch'].widget.choices],
)
Expand Down
10 changes: 5 additions & 5 deletions readthedocs/rtd_tests/tests/test_project_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def test_import_demo_imported_duplicate(self):
class TestPublicViews(MockBuildTestCase):
def setUp(self):
self.pip = get(Project, slug='pip')
self.pr_version = get(
self.external_version = get(
Version,
identifier='pr-version',
verbose_name='pr-version',
Expand All @@ -389,20 +389,20 @@ def test_project_detail_view_only_shows_internal_versons(self):
url = reverse('projects_detail', args=[self.pip.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertNotIn(self.pr_version, response.context['versions'])
self.assertNotIn(self.external_version, response.context['versions'])

def test_project_downloads_only_shows_internal_versons(self):
url = reverse('project_downloads', args=[self.pip.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertNotIn(self.pr_version, response.context['versions'])
self.assertNotIn(self.external_version, response.context['versions'])

def test_project_versions_only_shows_internal_versons(self):
url = reverse('project_version_list', args=[self.pip.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertNotIn(self.pr_version, response.context['active_versions'])
self.assertNotIn(self.pr_version, response.context['inactive_versions'])
self.assertNotIn(self.external_version, response.context['active_versions'])
self.assertNotIn(self.external_version, response.context['inactive_versions'])


class TestPrivateViews(MockBuildTestCase):
Expand Down
12 changes: 6 additions & 6 deletions readthedocs/rtd_tests/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUp(self):
self.client.login(username='eric', password='test')
self.pip = Project.objects.get(slug='pip')
# Create a External Version. ie: pull/merge request Version.
self.pr_version = get(
self.external_version = get(
Version,
identifier='9F86D081884C7D659A2FEAA0C55AD015A',
verbose_name='pr-version',
Expand Down Expand Up @@ -45,9 +45,9 @@ def setUp(self):

class TestVersionModel(VersionMixin, TestCase):

def test_vcs_url_for_pr_version(self):
expected_url = f'https://github.com/pypa/pip/pull/{self.pr_version.slug}/'
self.assertEqual(self.pr_version.vcs_url, expected_url)
def test_vcs_url_for_external_version(self):
expected_url = f'https://github.com/pypa/pip/pull/{self.external_version.slug}/'
self.assertEqual(self.external_version.vcs_url, expected_url)

def test_vcs_url_for_latest_version(self):
slug = self.pip.default_branch or self.pip.vcs_repo().fallback_branch
Expand All @@ -64,5 +64,5 @@ def test_commit_name_for_stable_version(self):
def test_commit_name_for_latest_version(self):
self.assertEqual(self.tag_version.commit_name, 'master')

def test_commit_name_for_pr_version(self):
self.assertEqual(self.pr_version.commit_name, self.pr_version.identifier)
def test_commit_name_for_external_version(self):
self.assertEqual(self.external_version.commit_name, self.external_version.identifier)

0 comments on commit 5a05b6c

Please sign in to comment.