@@ -22,7 +22,7 @@ def doCanonicalize(self, url, content):
2222 return content
2323
2424if settings .USE_DB_REDESIGN_PROXY_CLASSES :
25- from ietf .liaisons .models import LiaisonStatement
25+ from ietf .liaisons .models import LiaisonStatement , LiaisonStatementPurposeName
2626 from redesign .person .models import Person , Email
2727 from redesign .group .models import Group , Role
2828
@@ -87,7 +87,7 @@ def test_taken_care_of(self):
8787 q = PyQuery (r .content )
8888 self .assertEquals (len (q ('form input[name=do_action_taken]' )), 0 )
8989
90- # logged in and get
90+ # log in and get
9191 self .client .login (remote_user = "secretary" )
9292
9393 r = self .client .get (url )
@@ -103,7 +103,51 @@ def test_taken_care_of(self):
103103 liaison = LiaisonStatement .objects .get (id = liaison .id )
104104 self .assertTrue (liaison .action_taken )
105105
106+ def test_edit_liaison (self ):
107+ make_test_data ()
108+ liaison = make_liaison_models ()
109+
110+ url = urlreverse ('liaison_edit' , kwargs = dict (object_id = liaison .pk ))
111+ login_testing_unauthorized (self , "secretary" , url )
112+
113+ # get
114+ r = self .client .get (url )
115+ self .assertEquals (r .status_code , 200 )
116+ q = PyQuery (r .content )
117+ self .assertEquals (len (q ('form input[name=from_field]' )), 1 )
118+
119+ # edit
120+ r = self .client .post (url ,
121+ dict (from_field = "from" ,
122+ replyto = "replyto@example.com" ,
123+ organization = "org" ,
124+ to_poc = "to_poc@example.com" ,
125+ response_contact = "responce_contact@example.com" ,
126+ technical_contact = "technical_contact@example.com" ,
127+ cc1 = "cc1@example.com" ,
128+ purpose = "4" ,
129+ deadline_date = (liaison .deadline + datetime .timedelta (days = 1 )).strftime ("%Y-%m-%d" ),
130+ title = "title" ,
131+ submitted_date = (liaison .submitted + datetime .timedelta (days = 1 )).strftime ("%Y-%m-%d" ),
132+ body = "body" ,
133+ ))
134+ self .assertEquals (r .status_code , 302 )
135+ new_liaison = LiaisonStatement .objects .get (id = liaison .id )
136+ self .assertEquals (new_liaison .from_name , "from" )
137+ self .assertEquals (new_liaison .reply_to , "replyto@example.com" )
138+ self .assertEquals (new_liaison .to_name , "org" )
139+ self .assertEquals (new_liaison .to_contact , "to_poc@example.com" )
140+ self .assertEquals (new_liaison .response_contact , "responce_contact@example.com" )
141+ self .assertEquals (new_liaison .technical_contact , "technical_contact@example.com" )
142+ self .assertEquals (new_liaison .cc , "cc1@example.com" )
143+ self .assertEquals (new_liaison .purpose , LiaisonStatementPurposeName .objects .get (order = 4 ))
144+ self .assertEquals (new_liaison .deadline , liaison .deadline + datetime .timedelta (days = 1 )),
145+ self .assertEquals (new_liaison .title , "title" )
146+ self .assertEquals (new_liaison .submitted .date (), (liaison .submitted + datetime .timedelta (days = 1 )).date ())
147+ self .assertEquals (new_liaison .body , "body" )
148+ self .assertTrue (new_liaison .modified > liaison .modified )
106149
150+ # test links and edit button
107151
108152if not settings .USE_DB_REDESIGN_PROXY_CLASSES :
109153 # the above tests only work with the new schema
0 commit comments