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)) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches( html, ('<tr>' '<td data-label="TITLE"><a class="" href=".*">Assistant</a></td>' '<td data-label="GRADE">12</td>' '<td data-label="POSTING CLOSES">APR 21, 2099</td>' '<td data-label="REGION">Silicon Valley</td>' '</tr>' '<tr>' '<td data-label="TITLE"><a class="" href=".*">Manager</a></td>' '<td data-label="GRADE">1, 2, 3</td>' '<td data-label="POSTING CLOSES">AUG 05, 2099</td>' '<td data-label="REGION">Silicon Valley</td>' '</tr>'))
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'] ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<tr>' '<td data-label="TITLE"><a class="" href=".*">Assistant</a></td>' '<td data-label="GRADE">12</td>' '<td data-label="POSTING CLOSES">APR 21, 2099</td>' '<td data-label="REGION">Silicon Valley</td>' '</tr>' '<tr>' '<td data-label="TITLE"><a class="" href=".*">Manager</a></td>' '<td data-label="GRADE">1, 2, 3</td>' '<td data-label="POSTING CLOSES">AUG 05, 2099</td>' '<td data-label="REGION">DC, NY</td>' '</tr>' ))
def test_html_displays_no_data_message(self): table = JobListingTable() html = table.render(table.to_python({'empty_table_msg': 'No Jobs'})) self.assertHtmlRegexpMatches(html, ( '<h3>No Jobs</h3>' ))
def test_html_has_table(self): table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '^<table class="o-table table__stack-on-small">' '.*' '</table>$' ))
def test_html_has_table(self): table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '^<table class="o-table o-table__stack-on-small">' '.*' '</table>$' ))
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.assertHtmlRegexpMatches(html, ('<tr>' '<td>TITLE</td>' '<td>GRADE</td>' '<td>POSTING CLOSES</td>' '<td>REGION</td>' '</tr>'))
def test_html_displays_single_row(self): make_job_listing_page( title='CEO', close_date=date(2099, 12, 1) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<tr>' '.*' '</tr>' ))
def test_html_displays_single_row(self): make_job_listing_page(title='CEO', close_date=date(2099, 12, 1)) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ('<tr>' '<th scope="col">TITLE</th>' '<th scope="col">GRADE</th>' '<th scope="col">POSTING CLOSES</th>' '<th scope="col">REGION</th>' '</tr>'))
def test_html_formatting_no_grade(self): make_job_listing_page(title='CEO', close_date=date(2099, 12, 1)) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches( html, ('<tr>' '<td data-label="TITLE"><a class="" href=".*">CEO</a></td>' '<td data-label="GRADE"></td>' '<td data-label="POSTING CLOSES">DEC 01, 2099</td>' '<td data-label="REGION">Silicon Valley</td>' '</tr>'))
def test_html_has_header(self): table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<thead>' '<tr>' '<th scope="col">TITLE</th>' '<th scope="col">GRADE</th>' '<th scope="col">POSTING CLOSES</th>' '<th scope="col">REGION</th>' '</tr>' '</thead>' ))
def test_html_has_header(self): table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<thead>' '<tr>' '<th scope="col">TITLE</th>' '<th scope="col">GRADE</th>' '<th scope="col">POSTING CLOSES</th>' '<th scope="col">REGION</th>' '</tr>' '</thead>' ))
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.assertHtmlRegexpMatches(html, ( '<tr>' '<td>TITLE</td>' '<td>GRADE</td>' '<td>POSTING CLOSES</td>' '<td>REGION</td>' '</tr>' ))
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) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( 'TITLE' '.*' 'Assistant' '.*' 'GRADE' '.*' '12' '.*' 'POSTING CLOSES' '.*' 'Apr. 21, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley' '.*' 'TITLE' '.*' 'Manager' '.*' 'GRADE' '.*' '1, 2, 3' '.*' 'POSTING CLOSES' '.*' 'Aug. 5, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley' ))
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.assertHtmlRegexpMatches(html, ('<tr>' '.*' 'TITLE' '.*' 'GRADE' '.*' 'POSTING CLOSES' '.*' 'LOCATION' '.*' '</tr>'))
def test_html_displays_single_row(self): make_job_listing_page( title='CEO', close_date=date(2099, 12, 1) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<tr>' '<th scope="col">TITLE</th>' '<th scope="col">GRADE</th>' '<th scope="col">POSTING CLOSES</th>' '<th scope="col">REGION</th>' '</tr>' ))
def test_html_formatting_no_grade_or_region(self): make_job_listing_page( title='CEO', close_date=date(2099, 12, 1) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( '<tr>' '<td data-label="TITLE"><a class="" href=".*">CEO</a></td>' '<td data-label="GRADE"></td>' '<td data-label="POSTING CLOSES">DEC 01, 2099</td>' '<td data-label="REGION"></td>' '</tr>' ))
def test_html_formatting_no_grade(self): make_job_listing_page(title='CEO', close_date=date(2099, 12, 1)) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ('TITLE' '.*' 'CEO' '.*' 'GRADE' '.*' 'POSTING CLOSES' '.*' 'Dec. 1, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley'))
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.assertHtmlRegexpMatches(html, ( '<tr>' '.*' 'TITLE' '.*' 'GRADE' '.*' 'POSTING CLOSES' '.*' 'LOCATION' '.*' '</tr>' ))
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)) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ('TITLE' '.*' 'Assistant' '.*' 'GRADE' '.*' '12' '.*' 'POSTING CLOSES' '.*' 'Apr. 21, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley' '.*' 'TITLE' '.*' 'Manager' '.*' 'GRADE' '.*' '1, 2, 3' '.*' 'POSTING CLOSES' '.*' 'Aug. 5, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley'))
def test_html_formatting_no_grade(self): make_job_listing_page( title='CEO', close_date=date(2099, 12, 1) ) table = JobListingTable() html = table.render(table.to_python({})) self.assertHtmlRegexpMatches(html, ( 'TITLE' '.*' 'CEO' '.*' 'GRADE' '.*' 'POSTING CLOSES' '.*' 'Dec. 1, 2099' '.*' 'LOCATION' '.*' 'Silicon Valley' ))
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.assertHtmlRegexpMatches(html, ('<thead>' '.*' '</thead>'))
def test_html_displays_no_data_message(self): table = JobListingTable() html = table.render(table.to_python({'empty_table_msg': 'No Jobs'})) self.assertHtmlRegexpMatches(html, ('<h3>No Jobs</h3>'))