You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tasks.md
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@ At this point you have a styled application. Check out the styles:
140
140
141
141
## 3.3 - Database Path
142
142
143
-
@pytest.mark.app_db_path below all of the import statements, create a constant called `PATH`, that contains the path to the already created database stored in `db/jobs.sqlite`.
143
+
@pytest.mark.app_db_path Below all of the import statements, create a constant called `PATH`, that contains the path to the already created database stored in `db/jobs.sqlite`.
144
144
145
145
## 3.4 - Global Database Attribute
146
146
@@ -177,9 +177,11 @@ In the body of `execute_sql` create a variable called `db`. Assign this variable
177
177
- Set the default of `single` to `False`.
178
178
179
179
## 3.9 - Query Database Function Execute
180
+
180
181
@pytest.mark.app_execute_sql_execute In the body of `execute_sql` call the `execute` function on `connection`, pass in the `sql` and `values` variables. Assign the return value to a variable called `cursor`.
181
182
182
183
## 3.10 - Query Database Function Commit
184
+
183
185
@pytest.mark.app_execute_sql_commit In the body of `execute_sql`:
184
186
185
187
- Create an `if` statement to test if `commit` is `True`.
@@ -252,7 +254,7 @@ In `<p>` tag add the following:
252
254
## 4.8 - Show Jobs Macro For Loop Body
253
255
254
256
@pytest.mark.show_jobs_macro_for_loop_body In the body of the `for` loop add a `<div>` with two classes `column` and `is_half`.
255
-
257
+
256
258
- In this `column``<div>` add a call to the `show_job` macro passing in an individual `job` from the `for` loop.
257
259
258
260
## 4.9 - Import Macros
@@ -261,7 +263,7 @@ In `<p>` tag add the following:
261
263
262
264
```
263
265
{% from '_macros.html' import show_job, show_jobs with context %}
264
-
```
266
+
```
265
267
266
268
**Notes: Because each template extends `layouts.html` all of them will have access to these two new macros.**
267
269
@@ -284,7 +286,7 @@ Above the `render_template` function, call the `execute_sql` function:
284
286
- In the `render_template` function, pass a keyword argument of `jobs=jobs`.
285
287
286
288
**Preview**
287
-
289
+
288
290
At this point you can see all jobs on the homepage:
289
291
290
292
- Open a terminal at the root of the project
@@ -302,7 +304,7 @@ At this point you can see all jobs on the homepage:
302
304
In the file use an `extends` template tag to inherit `layout.html`.
303
305
304
306
After the `extends` tag add a template `block` called `content`. In the block call the `show_job` macro passing in `job`. **Note: Use the `{{}}` for the macro call.**
305
-
307
+
306
308
## 5.2 - Job Route Function
307
309
308
310
@pytest.mark.app_job_route In `app.py` create a function called `job`. In the body return a call to the `render_template` function passing in the newly created `job.html` template.
@@ -315,7 +317,7 @@ Still in `app.py`, add a route decorator with the URL path `/job/<job_id>` to th
315
317
316
318
## 5.4 - Job Route Parameter
317
319
318
-
@pytest.mark.app_job_route_parameter. To use the `job_id`, received from the URL, we need to pass it to the `job` function. Add `job_id` to the parameter list of the `job` function.
320
+
@pytest.mark.app_job_route_parameter To use the `job_id`, received from the URL, we need to pass it to the `job` function. Add `job_id` to the parameter list of the `job` function.
assertparameters.args[0] =='sql'andparameters.args[1] =='values'andparameters.args[2] =='commit'andparameters.args[3] =='single', 'Have you added the correct parameters to the `execute_sql` function parameters list?'
57
57
assertparameters.defaults[0] == () andparameters.defaults[1] ==Falseandparameters.defaults[2] ==False, 'Do the `args` and `one` parameters have the correct defaults in the `execute_sql` function parameters list?'
58
58
59
-
@pytest.mark.app_execute_sql_execute
59
+
@pytest.mark.test_app_execute_sql_execute_module3
60
60
deftest_app_execute_sql_execute_module3():
61
61
assert'execute_sql'indir(app), 'Have you defined a function named `execute_sql`.'
62
62
assert'execute:sql:values'inget_functions(app.execute_sql), 'Have you called the `execute` function in `execute_sql`?'
63
63
64
-
@pytest.mark.app_execute_sql_fetchall
65
-
deftest_app_execute_sql_fetchall_module3():
64
+
@pytest.mark.test_app_execute_sql_results_module3
65
+
deftest_app_execute_sql_results_module3():
66
66
assert'execute_sql'indir(app), 'Have you defined a function named `execute_sql`.'
67
67
assert'fetchall'inget_functions(app.execute_sql), 'Have you called the `fetchall` function in `execute_sql`?'
68
68
assert'fetchone'inget_functions(app.execute_sql), 'Have you called the `fetchone` function in `execute_sql`?'
assertlen(el) ==1, 'Has the `HTML` from `templates.html` been copied to the `index.html` template?'
69
69
70
-
@pytest.mark.display_all_jobs
70
+
@pytest.mark.test_display_all_jobs_module4
71
71
deftest_display_all_jobs_module4():
72
72
asserttemplate_exists('index'), 'The `index.html` template does not exist in the `templates` folder.'
73
73
assert'show_jobs:jobs'intemplate_functions('index', 'show_jobs'), 'Have you call the `show_jobs` macro in the `index.html` file?'
74
74
75
-
@pytest.mark.app_jobs_route_jobs
75
+
@pytest.mark.test_app_jobs_route_jobs_module4
76
76
deftest_app_jobs_route_jobs_module4():
77
77
assert'jobs'indir(app), 'Have you created the `jobs` function?'
78
78
execute_sql='execute_sql:SELECT job.id, job.title, job.description, job.salary, employer.id as employer_id, employer.name as employer_name FROM job JOIN employer ON employer.id = job.employer_id'
0 commit comments