Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4921 from jwhitlock/zones-are-dying-1462475
Browse files Browse the repository at this point in the history
bug 1462475: Remove some more references to zones
  • Loading branch information
escattone committed Aug 6, 2018
2 parents 1f487e9 + 9bdc876 commit 216fa0a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 42 deletions.
2 changes: 0 additions & 2 deletions kuma/wiki/signal_handlers.py
Expand Up @@ -14,8 +14,6 @@ def on_document_save(sender, instance, **kwargs):
"""
A signal handler to be called after saving a document. Does:
- trigger the cache invalidation of both the zone URLs and stack
cache for the given document
- trigger the cache invalidation of the contributor bar for the given
document
- trigger the renewal of the code sample job generation
Expand Down
29 changes: 1 addition & 28 deletions kuma/wiki/tests/test_views.py
Expand Up @@ -31,7 +31,7 @@
from ..content import get_seo_description
from ..events import EditDocumentEvent, EditDocumentInTreeEvent
from ..forms import MIDAIR_COLLISION
from ..models import Document, DocumentDeletionLog, DocumentZone, RevisionIP
from ..models import Document, DocumentDeletionLog, RevisionIP
from ..templatetags.jinja_helpers import get_compare_url
from ..views.document import _get_seo_parent_title

Expand Down Expand Up @@ -785,33 +785,6 @@ def test_creating_child_of_redirect(self):
parameters = parse_qs(urlparse(response['Location']).query)
assert parameters['parent'][0] == str(doc.id)

def test_creating_child_of_redirect_zoned_doc_with_unzoned_doc_slug(self):
"""
While trying to create a child of a redirected zone document with its
unzoned document slug, the parent of the child should be redirect's
parent.
"""
self.client.login(username='admin', password='testpass')
rev = revision(is_approved=True, save=True)
root_doc = rev.document
# Create a zone of the document
zoned_doc = DocumentZone(document=root_doc, url_root="zoned_url")
zoned_doc.save()

# Move the document to new slug
root_doc._move_tree(new_slug="moved_doc")

# Try to create a child doc with root document slug
unzoned_doc_child_full_slug = root_doc.slug + "/children_document"
url = reverse('wiki.document', args=[unzoned_doc_child_full_slug])
response = self.client.get(url, follow=True)
assert response.status_code == 200
# The parent id of the query should be same because while moving,
# a new document is created with old slug and make redirect to the
# old document
parameters = parse_qs(response.request['QUERY_STRING'])
assert parameters['parent'][0] == str(root_doc.id)

def test_child_of_redirect_to_non_document(self):
"""Return a 404 when accessing the child of a non-document redirect."""
self.client.login(username='admin', password='testpass')
Expand Down
8 changes: 2 additions & 6 deletions kuma/wiki/tests/test_views_document.py
Expand Up @@ -108,12 +108,8 @@ def authkey(wiki_user):
'http_method', ['put', 'post', 'delete', 'options', 'head'])
@pytest.mark.parametrize(
'endpoint', ['children', 'toc', 'json', 'json_slug'])
def test_disallowed_methods(client, db, http_method, endpoint):
"""
HTTP methods other than GET & HEAD are not allowed.
TODO: Remove db fixture when bug 1462475 (disable zone URL root) is fixed.
"""
def test_disallowed_methods(client, http_method, endpoint):
"""HTTP methods other than GET & HEAD are not allowed."""
kwargs = None
if endpoint != 'json':
kwargs = dict(document_path='Web/CSS')
Expand Down
2 changes: 1 addition & 1 deletion kuma/wiki/views/document.py
Expand Up @@ -244,7 +244,7 @@ def _get_doc_and_fallback_reason(document_locale, document_slug):
parent_fields = ['parent__{}'.format(field) for field in ('locale', 'slug', 'current_revision__slug')]
parent_topic_fields = ['parent_topic__{}'.format(field) for field in ('id', 'title', 'slug')]

document_fields = ['html', 'rendered_html', 'zone_subnav_local_html', 'body_html',
document_fields = ['html', 'rendered_html', 'body_html',
'locale', 'slug', 'title', 'is_localizable', 'rendered_errors',
'toc_html', 'summary_html', 'summary_text', 'quick_links_html']

Expand Down
2 changes: 1 addition & 1 deletion tests/pages/article.py
Expand Up @@ -6,7 +6,7 @@


class ArticlePage(BasePage):
"""A non-zone MDN wiki page."""
"""An MDN wiki page."""

URL_TEMPLATE = '/{locale}/docs/{slug}'
DEFAULT_LOCALE = 'en-US'
Expand Down
8 changes: 4 additions & 4 deletions tests/performance/smoke.py
Expand Up @@ -36,12 +36,12 @@ def media_queries(self):
self.client.get('/en-US/docs/Web/Guide/CSS/Media_queries')

@task(weight=49)
def learn_zone_js_basics(self):
self.client.get('/en-US/Learn/Getting_started_with_the_web/JavaScript_basics')
def learn_js_basics(self):
self.client.get('/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics')

@task(weight=30)
def learn_zone_home(self):
self.client.get('/en-US/Learn')
def learn_home(self):
self.client.get('/en-US/docs/Learn')

@task(weight=34)
def ru_home(self):
Expand Down

0 comments on commit 216fa0a

Please sign in to comment.