@@ -257,9 +257,9 @@ def test_person_export(self):
257257
258258 def test_api_v2_person_export_view (self ):
259259 url = urlreverse ('ietf.api.views.ApiV2PersonExportView' )
260- secretariat_role = RoleFactory ( group__acronym = 'secretariat' , name_id = 'secr' )
261- secretariat = secretariat_role . person
262- apikey = PersonalApiKey .objects .create (endpoint = url , person = secretariat )
260+ robot = PersonFactory ( user__is_staff = True )
261+ RoleFactory ( name_id = 'robot' , person = robot , email = robot . email (), group__acronym = 'secretariat' )
262+ apikey = PersonalApiKey .objects .create (endpoint = url , person = robot )
263263
264264 # error cases
265265 r = self .client .post (url , {})
@@ -270,25 +270,19 @@ def test_api_v2_person_export_view(self):
270270 badrole .person .user .last_login = timezone .now ()
271271 badrole .person .user .save ()
272272 r = self .client .post (url , {'apikey' : badapikey .hash ()})
273- self .assertContains (r , "Restricted to role: Secretariat" , status_code = 403 )
274-
275- r = self .client .post (url , {'apikey' : apikey .hash ()})
276- self .assertContains (r , "Too long since last regular login" , status_code = 400 )
277- secretariat .user .last_login = timezone .now ()
278- secretariat .user .save ()
273+ self .assertContains (r , "Restricted to role: Robot" , status_code = 403 )
279274
280275 r = self .client .post (url , {'apikey' : apikey .hash ()})
281276 self .assertContains (r , "No filters provided" , status_code = 400 )
282277
283278 # working case
284- r = self .client .post (url , {'apikey' : apikey .hash (), 'email' : secretariat .email ().address , '_expand' : 'user' })
279+ r = self .client .post (url , {'apikey' : apikey .hash (), 'email' : robot .email ().address , '_expand' : 'user' })
285280 self .assertEqual (r .status_code , 200 )
286281 jsondata = r .json ()
287- data = jsondata ['person.person' ][str (secretariat .id )]
288- self .assertEqual (data ['name' ], secretariat .name )
289- self .assertEqual (data ['ascii' ], secretariat .ascii )
290- self .assertEqual (data ['user' ]['email' ], secretariat .user .email )
291-
282+ data = jsondata ['person.person' ][str (robot .id )]
283+ self .assertEqual (data ['name' ], robot .name )
284+ self .assertEqual (data ['ascii' ], robot .ascii )
285+ self .assertEqual (data ['user' ]['email' ], robot .user .email )
292286
293287 def test_api_new_meeting_registration (self ):
294288 meeting = MeetingFactory (type_id = 'ietf' )
0 commit comments