import pytest import sys from jobs import app from .utils import * @pytest.mark.test_template_macros_module4 def test_template_macros_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' @pytest.mark.test_show_job_macro_definition_module4 def test_show_job_macro_definition_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' assert 'show_job:job' in template_macros('_macros'), 'Have you created the `show_job` macro and added the correct parameter?' @pytest.mark.test_show_job_macro_html_module4 def test_show_job_macro_html_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' html = template_macro_soup('_macros', 'show_job') p = html.select('.card .card-header .card-header-title') div = html.select('.card-content .content') assert len(p) == 1 and len(div) == 1, 'Has the `HTML` from `templates.html` been copied to the `show_job` macro?' @pytest.mark.test_show_job_macro_header_module4 def test_show_job_macro_header_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' assert 'job:title' in template_variables('_macros'), 'Looks like the job title link does not have content.' @pytest.mark.test_show_job_macro_body_module4 def test_show_job_macro_body_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' assert 'job:employer_name' in template_variables('_macros'), 'Are you showing the employer name?' assert 'job:salary' in template_variables('_macros'), 'Are you showing the job salary?' assert 'job:description' in template_variables('_macros'), 'Are you showing the job description?' @pytest.mark.test_show_jobs_macro_definition_module4 def test_show_jobs_macro_definition_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' assert 'show_jobs:jobs' in template_macros('_macros'), 'Have you created the `show_jobs` macro and added the correct parameter?' @pytest.mark.test_show_jobs_macro_for_loop_module4 def test_show_jobs_macro_for_loop_module4(): assert template_exists('_macros'), 'The `_macros.html` template does not exist in the `templates` folder.' assert 'show_jobs:jobs' in template_macros('_macros'), 'Have you created the `show_jobs` macro and added the correct parameter?' html = template_macro_soup('_macros', 'show_jobs') div = html.select('div.columns.is-multiline') assert len(div) == 1, 'Has a `