@@ -154,7 +154,6 @@ def test_private_merge_view(self):
154154
155155 ## Add feedbacks (internally the function does new nominations)
156156 self .access_member_url (self .private_feedback_url )
157-
158157 self .feedback_view (public = False ,
159158 nominee_email = nominees [0 ],
160159 position = 'IAOC' )
@@ -251,9 +250,9 @@ def test_private_merge_view(self):
251250
252251 # Check nominations state
253252 self .assertEqual (NomineePosition .objects .get (position__name = 'TSV' ,
254- nominee = nominee ).state .slug , u'accepted' )
253+ nominee = nominee ).state .slug , u'accepted' )
255254 self .assertEqual (NomineePosition .objects .get (position__name = 'IAOC' ,
256- nominee = nominee ).state .slug , u'declined' )
255+ nominee = nominee ).state .slug , u'declined' )
257256
258257 self .client .logout ()
259258
@@ -542,8 +541,18 @@ def feedback_view(self, *args, **kwargs):
542541
543542 feedback_url += "?nominee=%d&position=%d" % (nominee .id , position .id )
544543
545- response = self .client .post (feedback_url , test_data )
544+ nominee_position = NomineePosition .objects .get (nominee = nominee ,
545+ position = position )
546+ state = nominee_position .state
547+ if not state .slug == 'accepted' :
548+ response = self .client .post (feedback_url , test_data )
549+ self .assertEqual (response .status_code , 200 )
550+ self .assertContains (response , "info-message-error" )
551+ # accept nomination
552+ nominee_position .state = NomineePositionState .objects .get (slug = 'accepted' )
553+ nominee_position .save ()
546554
555+ response = self .client .post (feedback_url , test_data )
547556 self .assertEqual (response .status_code , 200 )
548557 self .assertContains (response , "info-message-success" )
549558
@@ -559,6 +568,11 @@ def feedback_view(self, *args, **kwargs):
559568
560569 self .assertEqual (check_comments (feedback .comments , comments , self .privatekey_file ), True )
561570
571+ # recovery state
572+ if state != nominee_position .state :
573+ nominee_position .state = state
574+ nominee_position .save ()
575+
562576
563577class NomineePositionStateSaveTest (TestCase ):
564578 """Tests for the NomineePosition save override method"""
0 commit comments