def test_html_has_header(self): make_job_listing_page( title='CEO', close_date=date(2099, 12, 1) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertIn('<thead>', html)
def test_html_displays_table_if_row_flag_false(self): table = JobListingTable() html = table.render( table.to_python({'first_row_is_table_header': False})) self.assertNotIn('<thead>', html) self.assertIn('TITLE', html) self.assertIn('GRADE', html) self.assertIn('POSTING CLOSES', html) self.assertIn('LOCATION', html)
def test_html_displays_table_if_row_flag_false(self): table = JobListingTable() html = table.render(table.to_python( {'first_row_is_table_header': False} )) self.assertNotIn('<thead>', html) self.assertIn('TITLE', html) self.assertIn('GRADE', html) self.assertIn('POSTING CLOSES', html) self.assertIn('LOCATION', html)
def test_html_has_job_listings(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)) table = JobListingTable() html = table.render({}) self.assertIn('Manager', html) self.assertIn('Assistant', html) self.assertIn('1, 2, 3', html) self.assertIn('12', html) self.assertIn('Aug. 5, 2099', html) self.assertIn('Apr. 21, 2099', html) self.assertEqual(html.count('Silicon Valley'), 2)
def test_html_has_job_listings(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) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertIn('Manager', html) self.assertIn('Assistant', html) self.assertIn('1, 2, 3', html) self.assertIn('12', html) self.assertIn('Aug. 5, 2099', html) self.assertIn('Apr. 21, 2099', html) self.assertEqual(html.count('Silicon Valley'), 2)
def test_html_displays_no_data_message(self): table = JobListingTable() html = table.render(table.to_python({'empty_table_msg': 'No Jobs'})) self.assertInHTML('<h3>No Jobs</h3>', html)