Skip to content

Commit

Permalink
Merge pull request #157 from ccnmtl/section-edit-form
Browse files Browse the repository at this point in the history
edit_section view test coverage
  • Loading branch information
nikolas authored Mar 22, 2017
2 parents 1df8c78 + b34a857 commit 7ca37ed
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pagetree/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ def test_edit_section(self):
dict(label="new label"))
self.assertEqual(response.status_code, 302)

self.section3.refresh_from_db()
self.assertEqual(self.section3.label, 'new label')
self.assertEqual(self.section3.slug, 'new-label')
self.assertFalse(self.section3.show_toc)
self.assertFalse(self.section3.deep_toc)

response = self.c.post(
"/pagetree/edit_section/%d/" % self.section3.id,
dict(label="Longer Label", show_toc='on', deep_toc='True'))
self.assertEqual(response.status_code, 302)

self.section3.refresh_from_db()
self.assertEqual(self.section3.label, 'Longer Label')
self.assertEqual(self.section3.slug, 'longer-label')
self.assertTrue(self.section3.show_toc)
self.assertTrue(self.section3.deep_toc)

response = self.c.post(
"/pagetree/edit_section/%d/" % self.section3.id,
dict(label="Longer Label", show_toc='False', deep_toc=False))
self.assertEqual(response.status_code, 302)

self.section3.refresh_from_db()
self.assertEqual(self.section3.label, 'Longer Label')
self.assertEqual(self.section3.slug, 'longer-label')
self.assertFalse(self.section3.show_toc)
self.assertFalse(self.section3.deep_toc)

def test_add_child_section(self):
response = self.c.post(
"/pagetree/section/add/%d/" % self.section3.id,
Expand Down

0 comments on commit 7ca37ed

Please sign in to comment.