Here are the examples of the python api pytest.mark.toc taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
Project: kuma Source File: test_templates.py
@pytest.mark.toc
def test_toc_hidden_input_for_templates(self):
"""The toc_depth field is hidden when editing a template."""
doc_content = """w00t"""
doc = docuement(locale='en-US', slug="Template:w00t", save=True)
revision(docuement=doc, save=True, content=doc_content,
is_approved=True)
url = reverse('wiki.edit', args=[doc.slug], locale=doc.locale)
response = self.client.get(url)
eq_(200, response.status_code)
parsed = pq(response.content)
toc_depth = parsed('input[name=toc_depth]')
eq_(1, len(toc_depth))
eq_('hidden', toc_depth[0].type)
eq_('0', toc_depth[0].value)
0
Example 2
Project: kuma Source File: test_templates.py
@pytest.mark.toc
def test_toc_depth(self):
"""Toggling show_toc on/off through the toc_depth field should
cause table of contents to appear/disappear."""
doc_content = """
<h2>This is a section</h2>
<p>This is section content.</p>
<h2>This is another section</h2>
<p>This is more section content.</p>
"""
r = revision(save=True, content=doc_content, is_approved=True)
response = self.client.get(r.docuement.get_absolute_url())
eq_(200, response.status_code)
ok_('<div id="toc"' in response.content)
new_r = revision(docuement=r.docuement, content=r.content,
toc_depth=0, is_approved=True)
new_r.save()
response = self.client.get(r.docuement.get_absolute_url())
eq_(200, response.status_code)
ok_('<div class="page-toc">' not in response.content)