@@ -580,13 +580,28 @@ Not quite, but they did get a little further. Checking the line in which the
580
580
error occurred -- 'line 31' in my case -- , we can
581
581
// CSANAD: I think emphasizing what to look for in the error log is helpful.
582
582
see that we've got past the first part of the test, and are now onto the second
583
- check-- that submitting a second empty item also shows an error.
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 put an early return in the FT to separate
586
+ got some working code though, so let's have a commit:
587
+
588
+
589
+ [subs="specialcharacters,quotes"]
590
+ ----
591
+ $ *git commit -am "Adjust new list view to do model validation"*
592
+ ----
593
+
594
+
595
+ TIP: When working on a new feature, it's common to realize partway through that
596
+ a refactor of the application is needed. Adding an early return to the FT
597
+ you're currently working on allows you to perform this refactor against
598
+ passing FTs, even while the feature is still in progress.
599
+
600
+
601
+ Let's put an early return in the FT to separate
587
602
what we got working from those that still need to be dealt with:
603
+
588
604
[role="sourcecode"]
589
- // TODO fix code listing reference number
590
605
.src/functional_tests/test_list_item_validation.py (ch13l???)
591
606
====
592
607
[source,python]
@@ -603,6 +618,7 @@ class ItemValidationTest(FunctionalTest):
603
618
# Perversely, she now decides to submit a second blank list item
604
619
self.browser.find_element(By.ID, "id_new_item").send_keys(Keys.ENTER)
605
620
[...]
621
+ ----
606
622
====
607
623
608
624
@@ -615,16 +631,7 @@ We should also remind ourselves not to forget to remove this early return:
615
631
* 'Remove the early return from the FT'
616
632
*****
617
633
618
- ...and it's time to commit our changes:
619
-
620
-
621
- [subs="specialcharacters,quotes"]
622
- ----
623
- $ *git commit -am "Adjust new list view to do model validation"*
624
- ----
625
-
626
-
627
-
634
+ And now, we can focus on making our code a little neater.
628
635
629
636
630
637
=== Django Pattern: Processing POST Requests in the Same View as Renders the Form
831
838
----
832
839
833
840
834
- Let's try a full FT run: they're all passing! We can remove the early return
841
+ Let's try a full FT run: they're all passing!
842
+ Our refactor of the `add_item` functionality is complete.
843
+ We should commit there:
844
+
845
+ [subs="specialcharacters,quotes"]
846
+ ----
847
+ $ *git commit -am "Refactor list view to handle new item POSTs"*
848
+ ----
849
+
850
+
851
+ We can remove the early return
835
852
now.
836
853
837
854
[role="scratchpad"]
@@ -857,13 +874,6 @@ FAILED (errors=1)
857
874
----
858
875
859
876
We're back to the one failure in our new functional test.
860
- Our refactor of the `add_item` functionality is complete.
861
- We should commit there:
862
-
863
- [subs="specialcharacters,quotes"]
864
- ----
865
- $ *git commit -am "Refactor list view to handle new item POSTs"*
866
- ----
867
877
868
878
869
879
0 commit comments