File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,9 @@ def test_update(self):
69
69
self .assertEqual (response .status_code , 200 )
70
70
data = json .loads (response .get_data ())
71
71
self .assertEqual (data ['item' ]['value' ], 30 )
72
- # backup items should not change = proof need for deepcopy in setUp
73
- self .assertEqual (self .backup_items [2 ]['value' ], 20 ) # not 30!
72
+ # proof need for deepcopy in setUp: update app.items should not affect self.backup_items
73
+ # this fails when you use shallow copy
74
+ self .assertEqual (self .backup_items [2 ]['value' ], 20 ) # org value
74
75
75
76
def test_update_error (self ):
76
77
# cannot edit non-existing item
@@ -89,12 +90,11 @@ def test_update_error(self):
89
90
def test_delete (self ):
90
91
response = self .app .delete (GOOD_ITEM_URL )
91
92
self .assertEqual (response .status_code , 204 )
92
- # cannot delete non-existing item
93
93
response = self .app .delete (BAD_ITEM_URL )
94
94
self .assertEqual (response .status_code , 404 )
95
95
96
96
def tearDown (self ):
97
- # to start next test with fresh copy of items
97
+ # reset app.items to initial state
98
98
app .items = self .backup_items
99
99
100
100
You can’t perform that action at this time.
0 commit comments