Skip to content

miloserdova/django-with-asserts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-with-asserts - Test HTML with Context Managers

image

Make your Django HTML tests more explicit and concise.

Turn this:

self.assertContains(
    resp,
    '<input id="id_email" type="text" name="email" maxlength="75" value="bob@example.com>',
    html=True
)

Into this:

with self.assertHTML(resp, 'input[name="email"]') as (elem,):
    self.assertEqual(elem.value, 'bob@example.com')

About

Test Django HTML with Context Managers

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 93.3%
  • HTML 5.0%
  • Other 1.7%