@@ -229,6 +229,19 @@ def test_create_v1_batch_logged_user(self, mocker):
229229 self .assertEqual (list (response .context ["page" ].object_list ), [batch ])
230230 self .assertTrue (batch .is_initial )
231231
232+ @requests_mock .Mocker ()
233+ def test_create_empty_name (self , mocker ):
234+ ApiMocker .is_autoconfirmed (mocker )
235+ user , api_client = self .login_user_and_get_token ("user" )
236+ response = self .client .post ("/batch/new/" , data = {"type" : "v1" , "commands" : "CREATE" })
237+ self .assertEqual (response .status_code , 302 )
238+ response = self .client .get (response .url )
239+ self .assertEqual (response .status_code , 200 )
240+ response = self .client .post ("/batch/new/preview/allow_start/" )
241+ self .assertEqual (response .status_code , 302 )
242+ response = self .client .get (response .url )
243+ self .assertTemplateUsed ("batch.html" )
244+
232245 @requests_mock .Mocker ()
233246 def test_create_csv_batch_logged_user (self , mocker ):
234247 ApiMocker .is_autoconfirmed (mocker )
@@ -596,9 +609,8 @@ def test_batch_report(self, mocker):
596609 self .assertEqual (response .status_code , 200 )
597610 self .assertEqual (response .headers ["Content-Disposition" ], f'attachment; filename="batch-{ pk } -report.csv"' )
598611 result = (
599- """b'batch_id,index,operation,status,error,message,entity_id,raw_input,api_response\\ r\\ n"""
600- """1,0,set_statement,Done,,,Q1234,Q1234|P2|Q1,{\\ \' id\\ \' : \\ \' Q1234$stuff\\ \' }\\ r\\ n"""
601- """1,1,set_label,Done,,,Q11,"Q11|Len|""label""\" ,"""
602- """"{\\ \' id\\ \' : \\ \' Q11\\ \' , \\ \' labels\\ \' : {\\ \' en\\ \' : \\ \' label\\ \' }}"\\ r\\ n\' """
612+ """b'batch_id,index,operation,status,error,message,entity_id,raw_input\\ r\\ n"""
613+ """1,0,set_statement,Done,,,Q1234,Q1234|P2|Q1\\ r\\ n"""
614+ """1,1,set_label,Done,,,Q11,"Q11|Len|""label""\" \\ r\\ n\' """
603615 )
604616 self .assertEqual (result , str (response .content ).strip ())
0 commit comments