def setUp(self): self.clerk = MockClerk( Schema({ Node: "Node", Node.parent: "parentID", Node.children: "parentID", })) s = self.clerk.storage # we use the storage object so we can define the # database without dealing with read-only attribures (path) s.store("Node", name='top', path='top', parentID=0) s.store("Node", name='sub', path='top/sub', parentID=1) s.store("Node", name='subsub', path='top/sub/sub', parentID=2)
def setUp(self): self.storage = MockStorage() self.clerk = Clerk(self.storage, Schema({User: "******"})) self.app = AdminApp(self.clerk, {}) # set up some templates to play with: tpl = open("frm_test.zb", "w") tpl.write("ID is {:ID:}") tpl.close() tpl = open("lst_test.zb", "w") tpl.write("*# zebra to print a dot for each user:\n" "* for each:\n" " {:x:}\n") tpl.close()
def setUp(self): self.clerk = MockClerk(Schema(cornerhost.config.DBMAP)) self.user = self.clerk.store( User(username="******", server=Server(name="mockium")))
def fredClerk(): clerk = MockClerk(Schema(DBMAP)) return UserClerk(makeFred(clerk), clerk)
""" duckbill configuration file. modify this to fit your own site and table names. """ from clerks import Clerk, Schema from storage import MySQLStorage from duckbill import * # make this public key available to the user running duckbill: GNUPG_RECIPIENT = "*****@*****.**" schema = Schema({ #Customer: "bill_customer", #Customer.accounts: (Account, "customerID"), Account: "bill_account", Grace: "bill_grace", Grace.account: "accountID", Subscription: "bill_subscription", Subscription.account: "accountID", Event: "bill_event", Event.account: "accountID", }) def makeClerk(): import sqlCornerhost return Clerk(MySQLStorage(sqlCornerhost.connect()), schema)
print >> open(self.path + self.rssfile, "w"), rss if self.htmlfile and self.template: print >> open(self.path + self.htmlfile, "w"), self.toHTML() #@TODO: clean this up!! print >> open(self.path + "archive.inc.php", "w"), self.archiveList() print >> open(self.path + "feed.atom", "w"), self.toAtom() SCHEMA = Schema({ Channel: "rnt_channel", Channel.stories: "channelID", Channel.categories: "channelID", Category: "rnt_category", Category.channel: "channelID", Story: "rnt_story", Story.author: "authorID", Story.channel: "channelID", Story.category: "categoryID", Author: "rnt_author", Comment: "rant_comment", Comment.topic: "topicID", Topic: "rant_topic", }) """ Authentication based on rantelope Author class """ class AuthorAuthTest(unittest.TestCase): def test_login(self):
def setUp(self): self.clerk = MockClerk(Schema(cornerhost.config.DBMAP)) self.rate = Decimal("1.23") # dollars per gig... :) self.bwg = BandwidthGrunt(self.clerk, self.rate)
""" cornerhost control panel configuration file. modify this to fit your own site and table names. """ from clerks import Clerk, Schema from storage import MySQLStorage from cornerhost import * from cornerhost.dbmap import DBMAP schema = Schema(DBMAP) def makeClerk(): import sqlCornerhost return Clerk(MySQLStorage(sqlCornerhost.connect()), schema)