Skip to content

Commit 63afee6

Browse files
committed
add minor notes
1 parent 7f7807a commit 63afee6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

chapter_13_database_layer_validation.asciidoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ selenium.common.exceptions.NoSuchElementException: Message: Unable to locate
5656
element: .invalid-feedback; For documentation [...]
5757
----
5858

59+
// CSANAD: I don't have the "For documentation" here:
60+
// Unable to locate element: .invalid-feedback
61+
// I only have the stack trace.
62+
5963
It's expecting to see an error message if the user tries to input an empty
6064
item.
6165

@@ -131,6 +135,8 @@ except ValidationError:
131135

132136
But the `with` formulation is neater. Now, we can try running the test,
133137
and see its expected failure:
138+
// CSANAD: I would highlight we are running the unit test here
139+
// python src/manage.py test lists
134140

135141
----
136142
with self.assertRaises(ValidationError):
@@ -155,6 +161,7 @@ So why is the test still failing?
155161
Well, for
156162
http://bit.ly/2v3SfRq[slightly counterintuitive historical reasons],
157163
Django models don't run full validation on save.
164+
// CSANAD: I'd argue against the use of shortened URLs.
158165
As we'll see later,
159166
any constraints that are actually implemented in the database
160167
will raise errors on save,
@@ -167,6 +174,9 @@ But Django knows that SQLite doesn't support this type of constraint,
167174
so if we try to run `makemigrations`, it will report there's nothing to do:
168175

169176

177+
// CSANAD: maybe I'm missing something here but I don't think there would have
178+
// been any changes detected here even with another DB. I don't remember
179+
// changing the model since the last migration.
170180
[subs="specialcharacters,macros"]
171181
----
172182
$ pass:quotes[*python src/manage.py makemigrations*]
@@ -538,7 +548,9 @@ element: .invalid-feedback; [...]
538548
----
539549

540550

541-
Not quite, but they did get a little further. Checking 'line 31', we can
551+
Not quite, but they did get a little further. Checking the line in which the
552+
error occurred -- 'line 31' in my case -- , we can
553+
// CSANAD: I think emphasizing what to look for in the error log is helpful.
542554
see that we've got past the first part of the test, and are now onto the second
543555
check--that submitting a second empty item also shows an error.
544556

0 commit comments

Comments
 (0)