@@ -104,14 +104,24 @@ class testCsvExport(object):
104104
105105 def testCSVExportBase (self ):
106106 cl = self ._make_client (
107- {'@columns' : 'id,title,status,keyword,assignedto,nosy' },
107+ {'@columns' : 'id,title,status,keyword,assignedto,nosy,creation ' },
108108 nodeid = None , userid = '1' )
109109 cl .classname = 'issue'
110110
111111 demo_id = self .
db .
user .
create (
username = 'demo' ,
address = '[email protected] ' ,
112112 roles = 'User' , realname = 'demo' )
113113 key_id1 = self .db .keyword .create (name = 'keyword1' )
114114 key_id2 = self .db .keyword .create (name = 'keyword2' )
115+
116+ originalDate = date .Date
117+ dummy = date .Date ('2000-06-26.00:34:02.0' )
118+ # is a closure the best way to return a static Date object??
119+ def dummyDate (adate = None ):
120+ def dummyClosure (adate = None , translator = None ):
121+ return dummy
122+ return dummyClosure
123+ date .Date = dummyDate ()
124+
115125 self .db .issue .create (title = 'foo1' , status = '2' , assignedto = '4' , nosy = ['3' ,demo_id ])
116126 self .db .issue .create (title = 'bar2' , status = '1' , assignedto = '3' , keyword = [key_id1 ,key_id2 ])
117127 self .db .issue .create (title = 'baz32' , status = '4' )
@@ -120,26 +130,31 @@ def testCSVExportBase(self):
120130 cl .request .wfile = output
121131 # call export version that outputs names
122132 actions .ExportCSVAction (cl ).handle ()
123- should_be = (s2b ('"id","title","status","keyword","assignedto","nosy"\r \n '
124- '"1","foo1","deferred","","Contrary, Mary","Bork, Chef;Contrary, Mary;demo"\r \n '
125- '"2","bar2","unread","keyword1;keyword2","Bork, Chef","Bork, Chef"\r \n '
126- '"3","baz32","need-eg","","",""\r \n ' ))
133+ should_be = (s2b ('"id","title","status","keyword","assignedto","nosy","creation"\r \n '
134+ '"1","foo1","deferred","","Contrary, Mary","Bork, Chef;Contrary, Mary;demo","2000-06-26 00:34"\r \n '
135+ '"2","bar2","unread","keyword1;keyword2","Bork, Chef","Bork, Chef","2000-06-26 00:34"\r \n '
136+ '"3","baz32","need-eg","","","","2000-06-26 00:34"\r \n ' ))
137+
138+
127139 #print(should_be)
128- print (output .getvalue ())
140+ # print(output.getvalue())
129141 self .assertEqual (output .getvalue (), should_be )
130142 output = io .BytesIO ()
131143 cl .request = MockNull ()
132144 cl .request .wfile = output
133145 # call export version that outputs id numbers
134146 actions .ExportCSVWithIdAction (cl ).handle ()
135- should_be = s2b ('"id","title","status","keyword","assignedto","nosy"\r \n '
136- " \" 1 \" , \ " foo1\" , \" 2 \" , \ " []\" , \" 4 \" , \ " ['3', '4', '5']\" \r \n "
137- " \" 2 \" , \ " bar2\" , \" 1 \" , \ " ['1', '2']\" , \" 3 \" , \ " ['3']\" \r \n "
138- '\" 3 \ " ,"baz32",\" 4 \ " ,"[]","None","[]"\r \n ' )
147+ should_be = s2b ('"id","title","status","keyword","assignedto","nosy","creation" \r \n '
148+ '''"1", "foo1","2", "[]","4", "['3', '4', '5']","2000-06-26.00:34:02" \r \n '''
149+ '''"2", "bar2","1", "['1', '2']","3", "['3']","2000-06-26.00:34:02" \r \n '''
150+ '''"3 ","baz32","4 ","[]","None","[]","2000-06-26.00:34:02" \r \n '' ' )
139151 #print(should_be)
140152 #print(output.getvalue())
141153 self .assertEqual (output .getvalue (), should_be )
142154
155+ # reset the real date command
156+ date .Date = originalDate
157+
143158 # test full text search
144159 # call export version that outputs names
145160 cl = self ._make_client (
0 commit comments