def testBrowserLogin(self): """ Test that we can connect to a web page""" targetURL = "http://www.google.com" logger.debug('attempting to login to %s' % targetURL ) myBrowser = browserHTTP.browserHTTP() result = myBrowser.post(targetURL, None) if re.search("Feeling Lucky", result): assert True else: self.fail()
def testBrowserBadLogin(self): """ Test that we can't connect to a web page""" targetURL = "http://www.google.com/keepout" logger.debug('attempting to login to %s' % targetURL ) myBrowser = browserHTTP.browserHTTP() try: result = myBrowser.post(targetURL,None) self.fail() except browserHTTP.processingHTTPError: assert True
def __init__(self): """ Constructor """ self.myName = 'FeedFiddler' self.authFile = 'auth.txt' self.SessionToken = None self.apiURL = 'http://www.google.com/reader/api/0/' self.tokenURL = self.apiURL+'token' #read an initialization file that contains the values for the authentication tokens configs = ConfigParser.ConfigParser() configs.read('FeedFiddler.ini') #Password authentication method self.username = configs.get('SECURITY', 'username') self.password = configs.get('SECURITY', 'password') # a list of tuples composed of a tag and its regular expression self.rules= configs.items('RULES') #Initialize the browser self.browser = browserHTTP.browserHTTP()