@@ -1792,25 +1792,25 @@ def testCSVExport(self):
17921792 cl .request .wfile = output
17931793 # call export version that outputs names
17941794 actions .ExportCSVAction (cl ).handle ()
1795- #print(output.getvalue())
1796- should_be = (s2b ('id,title,status,keyword,assignedto,nosy\r \n '
1797- '1,foo1,deferred,,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n '
1798- '2,bar2,unread,keyword1;keyword2,"Bork, Chef","Bork, Chef"\r \n '
1799- '3,baz32,need-eg,,,\r \n ' ))
1795+ should_be = (s2b ('"id","title","status","keyword","assignedto","nosy"\r \n '
1796+ '"1","foo1","deferred","","Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n '
1797+ '"2","bar2","unread","keyword1;keyword2","Bork, Chef","Bork, Chef"\r \n '
1798+ '"3","baz32","need-eg","","",""\r \n ' ))
18001799 #print(should_be)
1801- # print(output.getvalue())
1800+ print (output .getvalue ())
18021801 self .assertEqual (output .getvalue (), should_be )
18031802 output = io .BytesIO ()
18041803 cl .request = MockNull ()
18051804 cl .request .wfile = output
18061805 # call export version that outputs id numbers
18071806 actions .ExportCSVWithIdAction (cl ).handle ()
1807+ should_be = s2b ('"id","title","status","keyword","assignedto","nosy"\r \n '
1808+ "\" 1\" ,\" foo1\" ,\" 2\" ,\" []\" ,\" 4\" ,\" ['3', '4', '5']\" \r \n "
1809+ "\" 2\" ,\" bar2\" ,\" 1\" ,\" ['1', '2']\" ,\" 3\" ,\" ['3']\" \r \n "
1810+ '\" 3\" ,"baz32",\" 4\" ,"[]","None","[]"\r \n ' )
1811+ #print(should_be)
18081812 print (output .getvalue ())
1809- self .assertEqual (s2b ('id,title,status,keyword,assignedto,nosy\r \n '
1810- "1,foo1,2,[],4,\" ['3', '4', '5']\" \r \n "
1811- "2,bar2,1,\" ['1', '2']\" ,3,['3']\r \n "
1812- '3,baz32,4,[],None,[]\r \n ' ),
1813- output .getvalue ())
1813+ self .assertEqual (output .getvalue (), should_be )
18141814
18151815 def testCSVExportCharset (self ):
18161816 cl = self ._make_client (
@@ -1827,8 +1827,8 @@ def testCSVExportCharset(self):
18271827 cl .request .wfile = output
18281828 # call export version that outputs names
18291829 actions .ExportCSVAction (cl ).handle ()
1830- should_be = (b'id, title, status, keyword, assignedto, nosy\r \n '
1831- b'1, foo1\xc3 \xa4 , deferred, ,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n ' )
1830+ should_be = (b'"id"," title"," status"," keyword"," assignedto"," nosy" \r \n '
1831+ b'"1"," foo1\xc3 \xa4 "," deferred","" ,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n ' )
18321832 self .assertEqual (output .getvalue (), should_be )
18331833
18341834 output = io .BytesIO ()
@@ -1837,8 +1837,8 @@ def testCSVExportCharset(self):
18371837 # call export version that outputs id numbers
18381838 actions .ExportCSVWithIdAction (cl ).handle ()
18391839 print (output .getvalue ())
1840- self .assertEqual (b'id, title, status, keyword, assignedto, nosy\r \n '
1841- b"1, foo1\xc3 \xa4 ,2,[],4 ,\" ['3', '4', '5']\" \r \n " ,
1840+ self .assertEqual (b'"id"," title"," status"," keyword"," assignedto"," nosy" \r \n '
1841+ b"\" 1 \" , \" foo1\xc3 \xa4 \" , \" 2 \" , \" [] \" , \" 4 \" ,\" ['3', '4', '5']\" \r \n " ,
18421842 output .getvalue ())
18431843
18441844 # again with ISO-8859-1 client charset
@@ -1848,8 +1848,8 @@ def testCSVExportCharset(self):
18481848 cl .request .wfile = output
18491849 # call export version that outputs names
18501850 actions .ExportCSVAction (cl ).handle ()
1851- should_be = (b'id, title, status, keyword, assignedto, nosy\r \n '
1852- b'1, foo1\xe4 , deferred, ,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n ' )
1851+ should_be = (b'"id"," title"," status"," keyword"," assignedto"," nosy" \r \n '
1852+ b'"1"," foo1\xe4 "," deferred","" ,"Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n ' )
18531853 self .assertEqual (output .getvalue (), should_be )
18541854
18551855 output = io .BytesIO ()
@@ -1858,8 +1858,8 @@ def testCSVExportCharset(self):
18581858 # call export version that outputs id numbers
18591859 actions .ExportCSVWithIdAction (cl ).handle ()
18601860 print (output .getvalue ())
1861- self .assertEqual (b'id, title, status, keyword, assignedto, nosy\r \n '
1862- b"1, foo1\xe4 ,2,[],4 ,\" ['3', '4', '5']\" \r \n " ,
1861+ self .assertEqual (b'"id"," title"," status"," keyword"," assignedto"," nosy" \r \n '
1862+ b"\" 1 \" , \" foo1\xe4 \" , \" 2 \" , \" [] \" , \" 4 \" ,\" ['3', '4', '5']\" \r \n " ,
18631863 output .getvalue ())
18641864
18651865 def testCSVExportBadColumnName (self ):
@@ -1903,12 +1903,12 @@ def testCSVExportFailPermissionValidColumn(self):
19031903
19041904 actions .ExportCSVAction (cl ).handle ()
19051905 #print(output.getvalue())
1906- self .assertEqual (s2b ('id, username, address, password\r \n '
1907- '1, admin, [hidden], [hidden]\r \n '
1908- '2, anonymous, [hidden], [hidden]\r \n '
1909- '3, Chef, [hidden], [hidden]\r \n '
1910- '4, mary, [hidden], [hidden]\r \n '
1911- '5, demo, [email protected] ,%s \r \n ' % (
passwd )),
1906+ self .assertEqual (s2b ('"id"," username"," address"," password" \r \n '
1907+ '"1"," admin"," [hidden]"," [hidden]" \r \n '
1908+ '"2"," anonymous"," [hidden]"," [hidden]" \r \n '
1909+ '"3"," Chef"," [hidden]"," [hidden]" \r \n '
1910+ '"4"," mary"," [hidden]"," [hidden]" \r \n '
1911+ '"5"," demo"," [email protected] ","%s" \r \n ' % (
passwd )),
19121912 output .getvalue ())
19131913
19141914 def testCSVExportWithId (self ):
@@ -1919,9 +1919,9 @@ def testCSVExportWithId(self):
19191919 cl .request = MockNull ()
19201920 cl .request .wfile = output
19211921 actions .ExportCSVWithIdAction (cl ).handle ()
1922- self .assertEqual (s2b ('id, name\r \n 1, unread\r \n 2, deferred\r \n 3, chatting\r \n '
1923- '4, need-eg\r \n 5, in-progress\r \n 6, testing\r \n 7, done-cbb\r \n '
1924- '8, resolved\r \n ' ),
1922+ self .assertEqual (s2b ('"id"," name" \r \n "1"," unread" \r \n "2"," deferred" \r \n "3"," chatting" \r \n '
1923+ '"4"," need-eg" \r \n "5"," in-progress" \r \n "6"," testing" \r \n "7"," done-cbb" \r \n '
1924+ '"8"," resolved" \r \n ' ),
19251925 output .getvalue ())
19261926
19271927 def testCSVExportWithIdBadColumnName (self ):
0 commit comments