Exemplo n.º 1
0
    def check_addContent(self):

        myRequest = weblib.Request(
            environ={"PATH_INFO":"add.py"},
            querystring="auth_check_flag=1",
            form={"auth_name":"username",
                  "auth_pass":"******",
                  "title":"testSubject",
                  "content":"content",
                  "submit":"1"
                  }
            )

        addPage = open(filename['addPage'], "r")
        
        eng = weblib.Engine(script=addPage, request=myRequest)
        eng.run()

        cur = dbc.cursor()
        cur.execute("select ID, title, content from base_content")
        row = cur.fetchone()

        assert row is not None, "addPage didn't add the content!"
        assert row[0] == 1, "ID should be 1, was: " + `row[0]`
        assert row[1] == "testSubject", "subject should be `testSubject`, was: " + `row[1]`
        assert row[2] == "content", "content should be 'content', got: " + `row[2]`
Exemplo n.º 2
0
    def check_addContent(self):

        myRequest = weblib.Request(environ={"PATH_INFO": "add.py"},
                                   querystring="auth_check_flag=1",
                                   form={
                                       "auth_name": "username",
                                       "auth_pass": "******",
                                       "title": "testSubject",
                                       "content": "content",
                                       "submit": "1"
                                   })

        addPage = open(filename['addPage'], "r")

        eng = weblib.Engine(script=addPage, request=myRequest)
        eng.run()

        cur = dbc.cursor()
        cur.execute("select ID, title, content from base_content")
        row = cur.fetchone()

        assert row is not None, "addPage didn't add the content!"
        assert row[0] == 1, "ID should be 1, was: " + ` row[0] `
        assert row[
            1] == "testSubject", "subject should be `testSubject`, was: " + ` row[
                1] `
        assert row[
            2] == "content", "content should be 'content', got: " + ` row[2] `
Exemplo n.º 3
0
 def setUp(self):
     cur = dbc.cursor()
     cur.execute("DELETE FROM base_content")
Exemplo n.º 4
0
#!/usr/home/sabren/bin/python

import zikebase
import weblib.script
from sqlTest import dbc

cur = dbc.cursor()
cur.execute("select ID, title, content from base_content")

print '<b>note:</b> when asked to login, the user="******" and pass="******".<br>'
print 'Also: <i>this is a <b>test environment</b>. Anything you post will get wiped out'
print 'the next time I run the test suite.</i> Don\'t be surprised if things disappear!'
print '- michal [<a href="http://www.linkwatcher.com/metalog/">back to metalog</a>]'
print '<hr>'

print '<table border="0" width="75%">'
print '<tr><td><h1>BlogDrive 0.0!</h1></td>'
print '<td align="right"><a href="add.py">add</a></tr>'
print '<tr><td colspan="2"><hr></td></tr>'

for row in cur.fetchall():
    ID, title, content = row

    print '<tr><td><b>' + title + '</b></td>'
    print '<td align="right">'
    print '<a href="add.py?ID=%s">edit</a>' % ID
    print '<a href="del.py?ID=%s">delete</a>' % ID
    print '</td></tr>'
    print '<tr><td colspan="2">'
    print content
    print '</td></tr>'
Exemplo n.º 5
0
 def setUp(self):
     cur = dbc.cursor()
     cur.execute("DELETE FROM base_content")
Exemplo n.º 6
0
#!/usr/home/sabren/bin/python

import zikebase
import weblib.script
from sqlTest import dbc

cur = dbc.cursor()
cur.execute("select ID, title, content from base_content")

print '<b>note:</b> when asked to login, the user="******" and pass="******".<br>'
print 'Also: <i>this is a <b>test environment</b>. Anything you post will get wiped out'
print 'the next time I run the test suite.</i> Don\'t be surprised if things disappear!'
print '- michal [<a href="http://www.linkwatcher.com/metalog/">back to metalog</a>]'
print '<hr>'

print '<table border="0" width="75%">'
print '<tr><td><h1>BlogDrive 0.0!</h1></td>'
print '<td align="right"><a href="add.py">add</a></tr>'
print '<tr><td colspan="2"><hr></td></tr>'

for row in cur.fetchall():
    ID, title, content = row

    print '<tr><td><b>' + title + '</b></td>'
    print '<td align="right">'
    print '<a href="add.py?ID=%s">edit</a>' % ID
    print '<a href="del.py?ID=%s">delete</a>' % ID
    print '</td></tr>'
    print '<tr><td colspan="2">'
    print content
    print '</td></tr>'