Changeset 4346
- Timestamp:
- 09/26/08 11:34:03 (3 months ago)
- Files:
-
- testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/__init__.py (added)
- testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/properties.py (modified) (7 diffs)
- testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testRuns.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/properties.py
r3908 r4346 16 16 import logging 17 17 import logging.handlers 18 import trac.util.text as TracText 18 19 from trac import env 19 20 from trac.versioncontrol import api … … 36 37 components = [] 37 38 for c in Component.select(component.env) : 38 components.append( c.name)39 components.append(TracText.to_unicode( c.name )) 39 40 return components 40 41 … … 102 103 try: 103 104 content = entry.get_content().read() 104 testcase = TestCase( entry.get_name(), str(content), component, entry.get_name() )105 testcases[ testcase.getId().encode('ascii', 'ignore').strip() ] = testcase106 105 testcase = TestCase( TracText.to_unicode( entry.get_name() ), TracText.to_unicode(content), component, entry.get_name() ) 106 testcases[ TracText.to_unicode ( testcase.getId() ).strip() ] = testcase 107 component.env.log.debug( "added testcase : " + testcase.getId() + " FROM file : " + TracText.to_unicode( entry.get_name() ) ) 107 108 except Exception, ex: 108 109 errors.append( "The testcase :" + entry.get_name() + " is not well formed xml...a parse error occured " ) … … 115 116 try: 116 117 currentTestcase = value #in case we do toss an exception I'll want some information from this testcase 117 components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project118 components.index( TracText.to_unicode( value.getComponent() ).strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project 118 119 119 120 except Exception, ex: … … 253 254 254 255 def getId(self) : 255 return self.id. encode('ascii', 'ignore').strip()256 return self.id.strip() 256 257 257 258 def getSummary(self): … … 268 269 269 270 def __init__(self, testcasename, testCaseContent, component, fileName = None ) : 270 self.id = ""271 self.summary = ""272 self.description = ""273 self.expectedresult = ""274 self.component = ""275 self.fileName = ""271 self.id = unicode( '' ) 272 self.summary = unicode( '' ) 273 self.description = unicode( '' ) 274 self.expectedresult = unicode( '' ) 275 self.component = unicode( '' ) 276 self.fileName = unicode( '' ) 276 277 277 278 self.fileName = fileName … … 287 288 for child in aNode.childNodes: 288 289 if child.nodeType == xml.dom.minidom.Node.TEXT_NODE : 289 self.__dict__[a] += child.data290 self.__dict__[a] += TracText.to_unicode( child.data ) 290 291 #else...we don't care about other kinds of nodes...not that there should be any. 291 292 testcasemanagementplugin/branches/testManagmentPluginGenshi/testManagementPlugin/testRuns.py
r3704 r4346 17 17 import logging 18 18 import logging.handlers 19 import trac.util.text as TracText 19 20 from trac.core import * 20 21 from trac.ticket import Component as TracComponent, Milestone, Ticket, TicketSystem … … 51 52 #ok generate some tickets already... 52 53 req.perm.assert_permission('TICKET_CREATE') #but first check to make sure they are allowed to create tickets... 53 success, errorMessage_orQueryURL = self.generateTracTickets( req )54 success, errorMessage_orQueryURL = self.generateTracTickets( req) 54 55 55 56 if success: … … 58 59 59 60 else: 60 61 data["error Message"] = errorMessage_orQueryURL61 data["errorMessage"] = "There is a configuration problem...issues listed below" 62 data["errorsList"] = errorMessage_orQueryURL 62 63 return "testRunNotConfigured.html", data, None 63 64 64 65 elif errors != None : 65 self.env.log.info( "ARG!") 66 data["errorMessage"] = errors 67 return template, data, content_type 66 #self.env.log.info( "ARG!") 67 data["errorMessage"] = "There is a configuration problem...issues listed below" 68 data["errorsList"] = errors 69 return "testRunNotConfigured.html", data, None 68 70 69 71 else: … … 103 105 self.env.log.info( "TESTCASES" + repr(testcases) + " ERRORS : " + repr(errors) ) 104 106 107 self.env.log.info( "LENGTH OF TESTCASES : " + str ( len( testcases ) ) ) 108 105 109 if testcases == None or len(errors) > 0 : 106 110 data["errorMessage"] = "No test cases found or other error...see list below if any" … … 110 114 for key, testcase in testcases.iteritems(): 111 115 testcaseNames.append( testcase.getId() ) 116 self.env.log.info( "Added test case id : " + testcase.getId() + " to the list " ) 117 112 118 testcaseNames.sort() 113 119 … … 161 167 if testRunKeyWord == None : 162 168 testRunKeyWord = "" 163 testRunKeyWord = self.properties.trimOutAnyProblemStrings(testRunKeyWord) #this is manually typed in...so it's probably to look for sqlInjection etc...169 testRunKeyWord = self.properties.trimOutAnyProblemStrings(testRunKeyWord) #this is manually typed in...so it's probably a good idea to look for sqlInjection etc... 164 170 165 171 if version == None: … … 172 178 #check to see if the user, templates or testcases parameters is a str/unicode or a list (well if it isn't a unicode or str then it is a list) 173 179 if isinstance( users, unicode): 174 users = [users .encode('ascii', 'ignore')]180 users = [users] 175 181 176 182 if isinstance( users, str): 177 users = [ users]183 users = [TracText.to_unicode ( users )] 178 184 179 185 if isinstance( testcases, unicode) : 180 testcases = [testcases .encode('ascii', 'ignore')]186 testcases = [testcases] 181 187 182 188 if isinstance( testcases, str ): … … 184 190 185 191 if isinstance( testTemplates, unicode) : 186 testTemplates = [testTemplates .encode('ascii', 'ignore')]192 testTemplates = [testTemplates] 187 193 188 194 if isinstance( testTemplates, str ): 189 testTemplates = [ testTemplates]190 191 192 version = version.encode('ascii', 'ignore').strip()193 milestone = milestone.encode('ascii', 'ignore').strip()195 testTemplates = [TracText.to_unicode ( testTemplates) ] 196 197 198 version = TracText.to_unicode ( version).strip() 199 milestone = TracText.to_unicode ( milestone ).strip() 194 200 195 201 if testcases == None : … … 218 224 for aUser in users : 219 225 for testId in testcases : 220 testId = testId.encode('ascii', 'ignore').strip()226 testId = TracText.to_unicode( testId ).strip() 221 227 if testId in allTestcases : 222 228 continue 223 229 else: 224 errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" ) 230 self.env.log.info( "Testcase : " + testId + " not found in master list " ) 231 errorMessages.append( "The test: " + testId + ", doesn't match it's file name or you've specified it wrong in the testtemplates.xml file" ) 232 225 233 if errorMessages: 226 234 return False, errorMessages … … 263 271 264 272 def createCombinedTestCaseList( self, testTemplates, testcases, req ) : 265 273 266 274 if len(testTemplates) < 1 : 267 275 return testcases #hopefully testcases isn't < 1 as well... … … 270 278 tempTestCaseList = [] 271 279 for name in testTemplates : 272 name = name.encode('ascii', 'ignore')280 name = TracText.to_unicode ( name ) 273 281 name = self.properties.trimOutAnyProblemStrings(name ) 274 282 testIds = projTemplates.getTestsForTemplate( name )
