def projectPassTest(): gitConnection = GitConnect() gitConnection.checkForUnsavedChanges() caseno = gitConnection.extractCaseFromBranch() gitConnection.pushChangesToOriginBranch(gitConnection.getBranch()) gitConnection.checkoutMaster() fbConnection = FogBugzConnect() (parent,test) = fbConnection.getCaseTuple(caseno) statuses = fbConnection.getStatuses(test) for i in range(0,len(statuses.keys())): print i,": ",statuses[sorted(statuses.keys())[i]] print "Choose your adventure: ", choice = input() ix = sorted(statuses.keys())[choice] fbConnection.resolveCase(test,ixstatus=ix) fbConnection.closeCase(test) fbConnection.fbConnection.assign(ixBug=parent,ixPersonAssignedTo=magic.BUILDBOT_IXPERSON) # play sounds! getstatusoutput("afplay -v 7 %s/media/longcheer.aiff" % sys.prefix)
class MockRepo: git = None dir = None fb = None def __init__(self, dir=None): if not dir: dir = "%s/mockrepo/" % tempfile.gettempdir() if not os.path.exists(dir): os.makedirs(dir) self.dir = dir self.git = GitConnect(self.dir) self.fb = FogBugzConnect() def createFile(self, name, contents): self.editFile(name, contents) def editFile(self, name, contents): with open(self.dir+name, "w") as file: file.write(contents) def readFile(self, name): with open(self.dir+name, "r") as file: return file.read() def gitInit(self): self.git.statusOutput("git init", self.dir) def gitAdd(self, file): self.git.add(file) def gitCommit(self, message): self.git.commitAll(message) def gitPush(self, forceful=False): if forceful: self.git.statusOutput("git push -u -f") else: self.git.statusOutput("git push -u") def gitPull(self): self.git.fetch() self.git.pull() self.git.submoduleUpdate() #Drew would like to document that this is redundant. Bion would like to document that this redundancy is not clear. def gitMerge(self, branch): self.git.mergeIn(branch) def gitCheckout(self, branch): self.git.checkoutExistingBranchRaw(branch) #is this name really necessary? def wipeRepo__INCREDIBLY__DESTRUCTIVE_COMMAND(self): self.git.statusOutputExcept("git push -f --all --delete") self.git.statusOutput("rm -Rf .git") self.git.statusOutputExcept("git init") self.git = GetConnect(self.dir) self.git.statusOutputExcept("git remote add origin [email protected]:drewcrawford/SampleProject.git") self.createFile("README.txt", "test") self.gitAdd("README.txt") self.gitCommit("First Commit") self.gitPush() def ticketReactivate(self, ticket): if "Closed" in self.fb.getStatuses(ticket): self.fb.reactivate(ticket, 7, "Just testing...") def ticketResolve(self, ticket): self.fb.resolveCase(ticket) def ticketClose(self, ticket): self.fb.closeCase(ticket) def ticketAssign(self, ticket, ixUser): self.fb.assignCase(ticket, ixUser) def ticketCreate(self, title): return self.fb.createCase(title, 1, 1, 7) def ticketSetEstimate(self, ticket, estimate): self.fb.setEstimate(ticket, estimate)