コード例 #1
0
ファイル: pageloadertest.py プロジェクト: hicksjduk/sehicl
 def testGetPageTokenSpecifiedAndWrongAndRequired(self):
     params = {"session": "agsgas", "id": "fullContacts"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     result = PageLoader().getPage(params, conn)
     conn.close();
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=fullContacts">        
     """
     self.assertNotEqual(-1, result.find(redirectLink.strip()))
コード例 #2
0
 def testGetPageTokenSpecifiedAndWrongAndRequired(self):
     params = {"session": "agsgas", "id": "fullContacts"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     result = PageLoader().getPage(params, conn)
     conn.close()
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=fullContacts">        
     """
     self.assertNotEqual(-1, result.find(redirectLink.strip()))
コード例 #3
0
ファイル: pageloadertest.py プロジェクト: hicksjduk/sehicl
 def testGetPageTokenSpecifiedAndRight(self):
     params = {"session": "abc"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     conn.cursor().execute("insert into session (id, token) values (1, 'abc')")
     result = PageLoader().getPage(params, conn)
     conn.close();
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=home">        
     """
     self.assertEqual(-1, result.find(redirectLink.strip()))
コード例 #4
0
 def testGetPageTokenSpecifiedAndRight(self):
     params = {"session": "abc"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     conn.cursor().execute(
         "insert into session (id, token) values (1, 'abc')")
     result = PageLoader().getPage(params, conn)
     conn.close()
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=home">        
     """
     self.assertEqual(-1, result.find(redirectLink.strip()))