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())
Exemple #2
0
 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())
Exemple #7
0
 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 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())
Exemple #10
0
 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())
Exemple #11
0
 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())
Exemple #12
0
 def testHelpLong(self):
     """--help should print usage"""
     google.main(["--help"])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
Exemple #13
0
 def testVersionLong(self):
     """--version should print version"""
     google.main(["--version"])
     commandLineAnswer = self.lastOutput()
     google._version()
     self.assertEqual(commandLineAnswer, self.lastOutput())
Exemple #14
0
 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())
Exemple #15
0
 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())
Exemple #16
0
 def testNoOptions(self):
     """no options at all should print usage"""
     google.main([])
     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())
Exemple #18
0
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 testHelpLong(self):
     """--help should print usage"""
     google.main(["--help"])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
Exemple #20
0
def googl_srch():
    import google as goos
    goos.main()
    # return redirect('result.html')
    return redirect('/result')
 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())
Exemple #22
0
 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())