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 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 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 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())
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())