def test_html_formatting(self): make_job_listing_page( title='Manager', grades=['1', '2', '3'], close_date=date(2099, 8, 5), regions=['NY', 'DC'] ) make_job_listing_page( title='Assistant', grades=['12'], close_date=date(2099, 4, 21), regions=['Silicon Valley'] ) block = JobListingList() html = block.render( block.to_python({}), context={'request': self.request} ) self.assertHtmlRegexpMatches(html, ( '<li class="list_item">' '<a class="list_link" href=".*">Assistant</a>' '<p class="date">CLOSING<span class="datetime">' '.*APR 21, 2099.*</span></p>' '</li>' '<li class="list_item">' '<a class="list_link" href=".*">Manager</a>' '<p class="date">CLOSING<span class="datetime">.' '*AUG 05, 2099.*</span></p>' '</li>' ))
def test_html_formatting(self): make_job_listing_page(title='Manager', grades=['1', '2', '3'], close_date=date(2099, 8, 5)) make_job_listing_page(title='Assistant', grades=['12'], close_date=date(2099, 4, 21)) block = JobListingList() html = block.render(block.to_python({}), context={'request': self.request}) self.assertHtmlRegexpMatches( html, ('<li class="m-list_item">' '<a class="m-list_link" href=".*">Assistant' + '<span class="m-list_link-subtext">Closing' + '<span class="datetime">.*Apr. 21, 2099.*</span>' '</span></a>' '</li>' '<li class="m-list_item">' '<a class="m-list_link" href=".*">Manager' + '<span class="m-list_link-subtext">Closing' + '<span class="datetime">.*Aug. 5, 2099.*</span>' '</span></a>' '</li>'))
def test_html_formatting(self): make_job_listing_page( title='Manager', grades=['1', '2', '3'], close_date=date(2099, 8, 5) ) make_job_listing_page( title='Assistant', grades=['12'], close_date=date(2099, 4, 21) ) block = JobListingList() html = block.render( block.to_python({}), context={'request': self.request} ) self.assertHtmlRegexpMatches(html, ( '<li class="m-list_item">' '<a class="m-list_link" href=".*">Assistant' + '<span class="m-list_link-subtext">Closing' + '<span class="datetime">.*Apr. 21, 2099.*</span>' '</span></a>' '</li>' '<li class="m-list_item">' '<a class="m-list_link" href=".*">Manager' + '<span class="m-list_link-subtext">Closing' + '<span class="datetime">.*Aug. 5, 2099.*</span>' '</span></a>' '</li>' ))
def test_html_has_aside(self): block = JobListingList() html = block.render(block.to_python({})) self.assertHtmlRegexpMatches( html, ('^<aside class="m-jobs-list" data-qa-hook="openings-section">' '.*' '</aside>$'))
def test_html_has_aside(self): block = JobListingList() html = block.render(block.to_python({})) self.assertHtmlRegexpMatches(html, ( '^<aside class="m-jobs-list" data-qa-hook="openings-section">' '.*' '</aside>$' ))
def test_html_has_ul(self): make_job_listing_page(title='Manager', grades=['1', '2', '3'], close_date=date(2099, 8, 5)) block = JobListingList() html = block.render(block.to_python({}), context={'request': self.request}) self.assertHtmlRegexpMatches( html, ('<ul class="list list__unstyled">.*</ul>'))
def test_html_has_ul(self): make_job_listing_page( title='Manager', grades=['1', '2', '3'], close_date=date(2099, 8, 5) ) block = JobListingList() html = block.render( block.to_python({}), context={'request': self.request} ) self.assertHtmlRegexpMatches(html, ( '<ul class="m-list m-list__unstyled">.*</ul>' ))
def test_includes_live_jobs(self): job = make_job_listing_page('Job', live=True) qs = JobListingList().get_queryset({}) self.assertTrue(qs.exists()) self.assertEqual(job.title, qs[0].title)
def test_excludes_draft_jobs(self): make_job_listing_page('Job', live=False) qs = JobListingList().get_queryset({}) self.assertFalse(qs.exists())
def _render_block_to_html(self): block = JobListingList() return block.render(block.to_python({ 'more_jobs_page': self.more_jobs_page.pk, }))
def _render_block_to_html(self): block = JobListingList() return block.render( block.to_python({ 'more_jobs_page': self.more_jobs_page.pk, }))