def testShouldThinkSessionDocumentIsInvalidIfTitleIsCorrect(self): """Login is failure if the response document has the correct title.""" source = SessionScreenscrapeSource() document = "<html><head><title>Please Login</title></head><body></body></html>" is_valid = source.body_is_valid_session(document) self.assertEqual(is_valid, False)
def testShouldKnowAboutASimpleInvalidSessionDocumentBody(self): """Screenscrape source should have a simple document that triggers login failure""" source = SessionScreenscrapeSource() document = SessionScreenscrapeSource.SIMPLE_FAILURE_DOCUMENT is_valid = source.body_is_valid_session(document) self.assert_(not is_valid)
def testShouldThinkSessionDocumentIsValidIfTitleIsCorrect(self): """Login is successful if the response document has the correct title.""" source = SessionScreenscrapeSource() document = "<html><head><title>My Message Manager</title></head><body></body></html>" is_valid = source.body_is_valid_session(document) self.assertEqual(is_valid, True)