Esempio n. 1
0
    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>'))
Esempio n. 2
0
    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>'
        ))
Esempio n. 3
0
    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>'
        ))
Esempio n. 4
0
    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>$'
        ))
Esempio n. 5
0
    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>$'
        ))
Esempio n. 6
0
    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>'))
Esempio n. 7
0
    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>'))
Esempio n. 8
0
 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>'
     ))
Esempio n. 9
0
    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>'))
Esempio n. 10
0
    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>'
        ))
Esempio n. 11
0
    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>'
        ))
Esempio n. 12
0
    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>'
        ))
Esempio n. 13
0
    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'
        ))
Esempio n. 14
0
    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>'
        ))
Esempio n. 15
0
    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>'))
Esempio n. 16
0
    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>'
        ))
Esempio n. 17
0
    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'))
Esempio n. 18
0
    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>'
        ))
Esempio n. 19
0
    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'))
Esempio n. 20
0
    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'
        ))
Esempio n. 21
0
 def test_includes_live_jobs(self):
     job = make_job_listing_page('Job', live=True)
     qs = JobListingTable().get_queryset({})
     self.assertTrue(qs.exists())
     self.assertEqual(job.title, qs[0].title)
Esempio n. 22
0
 def test_excludes_draft_jobs(self):
     make_job_listing_page('Job', live=False)
     qs = JobListingTable().get_queryset({})
     self.assertFalse(qs.exists())
Esempio n. 23
0
    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>'))
Esempio n. 24
0
 def test_excludes_draft_jobs(self):
     make_job_listing_page('Job', live=False)
     qs = JobListingTable().get_queryset({})
     self.assertFalse(qs.exists())
Esempio n. 25
0
    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>'))
Esempio n. 26
0
 def test_includes_live_jobs(self):
     job = make_job_listing_page('Job', live=True)
     qs = JobListingTable().get_queryset({})
     self.assertTrue(qs.exists())
     self.assertEqual(job.title, qs[0].title)