@@ -583,7 +583,39 @@ see that we've got past the first part of the test, and are now onto the second
583
583
check--that submitting a second empty item also shows an error.
584
584
585
585
((("", startref="MLVsurfac13")))We've
586
- got some working code though, so let's have a commit:
586
+ got some working code though, so let's put an early return in the FT to separate
587
+ what we got working from those that still need to be dealt with:
588
+ [role="sourcecode"]
589
+ // TODO fix code listing reference number
590
+ .src/functional_tests/test_list_item_validation.py (ch13l???)
591
+ ====
592
+ [source,python]
593
+ ----
594
+ class ItemValidationTest(FunctionalTest):
595
+ def test_cannot_add_empty_list_items(self):
596
+ [...]
597
+ self.browser.find_element(By.ID, "id_new_item").send_keys(Keys.ENTER)
598
+ self.wait_for_row_in_list_table("1: Buy milk")
599
+
600
+ return
601
+ # TODO fix the remaining test scenarios
602
+
603
+ # Perversely, she now decides to submit a second blank list item
604
+ self.browser.find_element(By.ID, "id_new_item").send_keys(Keys.ENTER)
605
+ [...]
606
+ ====
607
+
608
+
609
+ We should also remind ourselves not to forget to remove this early return:
610
+
611
+
612
+ [role="scratchpad"]
613
+ *****
614
+ * 'Remove hardcoded URLs from views.py'
615
+ * 'Remove the early return from the FT'
616
+ *****
617
+
618
+ ...and it's time to commit our changes:
587
619
588
620
589
621
[subs="specialcharacters,quotes"]
@@ -642,6 +674,7 @@ and while we're thinking about it, there's one in 'home.html' too:
642
674
[role="scratchpad"]
643
675
*****
644
676
* 'Remove hardcoded URLs from views.py'
677
+ * 'Remove the early return from the FT'
645
678
* 'Remove hardcoded URL from forms in list.html and home.html'
646
679
*****
647
680
798
831
----
799
832
800
833
801
- Let's try a full FT run:
834
+ Let's try a full FT run: they're all passing! We can remove the early return
835
+ now.
836
+
837
+ [role="scratchpad"]
838
+ *****
839
+ * 'Remove hardcoded URLs from views.py'
840
+ * '[strikethrough line-through]#Remove the early return from the FT#'
841
+ * 'Remove hardcoded URL from forms in list.html and home.html'
842
+ *****
843
+
844
+ Run the FTs again to see what's still there that needs to be fixed:
802
845
803
846
804
847
[subs="specialcharacters,quotes"]
@@ -822,17 +865,6 @@ We should commit there:
822
865
$ *git commit -am "Refactor list view to handle new item POSTs"*
823
866
----
824
867
825
- NOTE: So did I break the rule about never refactoring against failing tests?
826
- In this case, it's allowed, because the refactor is required
827
- to get our new functionality to work.
828
- You should definitely never refactor against failing _unit_ tests.
829
- But in my book it's OK for the FT for the current story you're working on
830
- to be failing.footnote:[
831
- If you really want a "clean" test run, you could add a skip or an early return
832
- to the current FT, but you'd need to make sure you didn't accidentally forget it.]
833
-
834
-
835
-
836
868
837
869
838
870
==== Enforcing Model Validation in view_list
@@ -915,6 +947,7 @@ We'll just add it to our scratchpad for now:
915
947
[role="scratchpad"]
916
948
*****
917
949
* 'Remove hardcoded URLs from views.py'
950
+ * '[strikethrough line-through]#Remove the early return from the FT#'
918
951
* 'Remove hardcoded URL from forms in list.html and home.html'
919
952
* 'Remove duplication of validation logic in views'
920
953
*****
@@ -1029,6 +1062,7 @@ $ *git commit -am "Refactor hard-coded URLs out of templates"*
1029
1062
[role="scratchpad"]
1030
1063
*****
1031
1064
* 'Remove hardcoded URLs from views.py'
1065
+ * '[strikethrough line-through]#Remove the early return from the FT#'
1032
1066
* '[strikethrough line-through]#Remove hardcoded URL from forms in list.html and home.html#'
1033
1067
* 'Remove duplication of validation logic in views'
1034
1068
*****
@@ -1162,6 +1196,7 @@ Cross off our to-dos...
1162
1196
[role="scratchpad"]
1163
1197
*****
1164
1198
* '[strikethrough line-through]#Remove hardcoded URLs from views.py#'
1199
+ * '[strikethrough line-through]#Remove the early return from the FT#'
1165
1200
* '[strikethrough line-through]#Remove hardcoded URL from forms in list.html and home.html#'
1166
1201
* 'Remove duplication of validation logic in views'
1167
1202
*****
0 commit comments