def testSpellingLong(self): """--spelling should check spelling""" google.main(["--spelling", self.phrase]) commandLineAnswer = self.lastOutput() google._output(google.doSpellingSuggestion(self.phrase), self.spellingparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def testMetaLong(self): """--meta should return meta information""" google.main(["--meta", "-s", self.q]) commandLineAnswer = self.lastOutput() commandLineAnswer = commandLineAnswer[:commandLineAnswer.index('searchTime')] google._output(google.doGoogleSearch(self.q), self.metaparams) realAnswer = self.lastOutput() realAnswer = realAnswer[:realAnswer.index('searchTime')] self.assertEqual(commandLineAnswer, realAnswer)
def testMetaLong(self): """--meta should return meta information""" google.main(["--meta", "-s", self.q]) commandLineAnswer = self.lastOutput() commandLineAnswer = commandLineAnswer[:commandLineAnswer. index('searchTime')] google._output(google.doGoogleSearch(self.q), self.metaparams) realAnswer = self.lastOutput() realAnswer = realAnswer[:realAnswer.index('searchTime')] self.assertEqual(commandLineAnswer, realAnswer)
def testLuckyLong(self): """--lucky should return only first result""" google.main(["--lucky", "-s", self.q]) commandLineAnswer = self.lastOutput() google._output(google.doGoogleSearch(self.q), self.luckyparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def testCacheLong(self): """--cache should retrieve cache""" google.main(["--cache", self.url]) commandLineAnswer = self.lastOutput() google._output(google.doGetCachedPage(self.url), self.cacheparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def testNoOptions(self): """no options at all should print usage""" google.main([]) commandLineAnswer = self.lastOutput() google._usage() self.assertEqual(commandLineAnswer, self.lastOutput())
def testSearchLong(self): """--search should search""" google.main(["--search", self.q]) commandLineAnswer = self.lastOutput() google._output(google.doGoogleSearch(self.q), self.searchparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def testVersionLong(self): """--version should print version""" google.main(["--version"]) commandLineAnswer = self.lastOutput() google._version() self.assertEqual(commandLineAnswer, self.lastOutput())
def testSearchDefault(self): """no options + search phrase should search""" google.main([self.q]) commandLineAnswer = self.lastOutput() google._output(google.doGoogleSearch(self.q), self.searchparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def testHelpLong(self): """--help should print usage""" google.main(["--help"]) commandLineAnswer = self.lastOutput() google._usage() self.assertEqual(commandLineAnswer, self.lastOutput())
def testReverseLong(self): """--reverse should reverse results""" google.main(["--reverse", "-s", self.q]) commandLineAnswer = self.lastOutput() google._output(google.doGoogleSearch(self.q), self.reverseparams) self.assertEqual(commandLineAnswer, self.lastOutput())
try: virtenv = os.path.join(os.environ.get('OPENSHIFT_PYTHON_DIR', '.'), 'virtenv') python_version = "python" + str(sys.version_info[0]) + "." + str( sys.version_info[1]) os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib', python_version, 'site-packages') virtualenv = os.path.join(virtenv, 'bin', 'activate_this.py') if (sys.version_info[0] < 3): execfile(virtualenv, dict(__file__=virtualenv)) else: exec(open(virtualenv).read(), dict(__file__=virtualenv)) except IOError: pass # # IMPORTANT: Put any additional includes below this line. If placed above this # line, it's possible required libraries won't be in your searchable path # import google # # main(): # if __name__ == '__main__': google.main()
def googl_srch(): import google as goos goos.main() # return redirect('result.html') return redirect('/result')