def testSilentFailMode(self): cmd = copy.copy(ROSMSGPROTO_FN) cmd.extend(["msgfoobar", "-s", "foo123barxyz.bar"]) call = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE, env = self.new_environ) (output, erroutput) = call.communicate() self.assertEqual('', output) self.assertEqual('', erroutput)
def testFail(self): cmd = copy.copy(ROSMSGPROTO_FN) cmd.extend(["msg", "foo123barxyz"]) call = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE, env = self.new_environ) (output, erroutput) = call.communicate() self.assertEqual('', output) self.assertTrue('Unknown message name foo123barxyz' in erroutput)
def clone(org, repo): repo = repo.replace(".git", "") gett = 'https://ghe.Employer.com/' + org + '/' + repo + '.git' call = Popen(['git', 'clone', gett], stdout=PIPE) ret = call.communicate() print(ret) # Inject config goodies conf_file = repo + '/.git/config' conf = open(conf_file, 'a+') conf.write( "[http \"https://ghe.Employer.com\"]\n\tproxy = https://proxy.Employer.com:80\n\tsslVerify = false\n\n" ) conf.close() zipname = repo + '.zip' zipp = Popen(['zip', '-m', '-r', zipname, repo], stdout=PIPE) ret = zipp.communicate() return send_from_directory('/home/gh_bot', zipname, as_attachment=True)