@@ -484,7 +484,47 @@ def verify_relations(doc,target_name,status):
484484 verify_relations (doc ,'rfc9998' ,'tobcp' )
485485 verify_relations (doc ,'rfc14' ,'tohist' )
486486 self .assertTrue (doc .latest_event (DocEvent ,type = "added_comment" ).desc .startswith ('Affected RFC list changed.' ))
487+
488+ def test_clear_ballot (self ):
489+ doc = Document .objects .get (name = 'status-change-imaginary-mid-review' )
490+ url = urlreverse ('ietf.doc.views_ballot.clear_ballot' ,kwargs = dict (name = doc .name , ballot_type_slug = "statchg" ))
491+ login_testing_unauthorized (self , "secretary" , url )
492+
493+ # Some additional setup
494+ doc .relateddocument_set .create (target = Document .objects .get (name = 'rfc9999' ),relationship_id = 'tois' )
495+ doc .relateddocument_set .create (target = Document .objects .get (name = 'rfc9998' ),relationship_id = 'tohist' )
496+ create_ballot_if_not_open (None , doc , Person .objects .get (user__username = "secretary" ), "statchg" )
497+ doc .set_state (State .objects .get (slug = 'iesgeval' ,type = 'statchg' ))
498+ old_ballot = doc .ballot_open ("statchg" )
499+ self .assertIsNotNone (old_ballot )
500+
501+ r = self .client .post (url , dict ())
502+ self .assertEqual (r .status_code ,302 )
503+ new_ballot = doc .ballot_open ("statchg" )
504+ self .assertIsNotNone (new_ballot )
505+ self .assertNotEqual (new_ballot , old_ballot )
506+ self .assertEqual (doc .get_state_slug ("statchg" ),"iesgeval" )
507+
508+ def test_clear_deferred_ballot (self ):
509+ doc = Document .objects .get (name = 'status-change-imaginary-mid-review' )
510+ url = urlreverse ('ietf.doc.views_ballot.clear_ballot' ,kwargs = dict (name = doc .name , ballot_type_slug = "statchg" ))
511+ login_testing_unauthorized (self , "secretary" , url )
512+
513+ # Some additional setup
514+ doc .relateddocument_set .create (target = Document .objects .get (name = 'rfc9999' ),relationship_id = 'tois' )
515+ doc .relateddocument_set .create (target = Document .objects .get (name = 'rfc9998' ),relationship_id = 'tohist' )
516+ create_ballot_if_not_open (None , doc , Person .objects .get (user__username = "secretary" ), "statchg" )
517+ doc .set_state (State .objects .get (slug = 'defer' ,type = 'statchg' ))
518+ old_ballot = doc .ballot_open ("statchg" )
519+ self .assertIsNotNone (old_ballot )
487520
521+ r = self .client .post (url , dict ())
522+ self .assertEqual (r .status_code ,302 )
523+ new_ballot = doc .ballot_open ("statchg" )
524+ self .assertIsNotNone (new_ballot )
525+ self .assertNotEqual (new_ballot , old_ballot )
526+ self .assertEqual (doc .get_state_slug ("statchg" ),"iesgeval" )
527+
488528 def setUp (self ):
489529 super ().setUp ()
490530 IndividualRfcFactory (rfc_number = 14 ,std_level_id = 'unkn' ) # draft was never issued
0 commit comments