def setUp( self ): Test_controller.setUp( self ) Groups.urllib2 = Stub_urllib2 self.group_name = u"my group" self.group_name2 = u"other group" self.username = u"mulder" self.password = u"trustno1" self.email_address = u"*****@*****.**" self.username2 = u"scully" self.password2 = u"trustsome1" self.email_address2 = u"*****@*****.**" self.username3 = u"skinner" self.password3 = u"trustne1" self.email_address3 = u"*****@*****.**" self.group = Group.create( self.database.next_id( Group ), self.group_name ) self.database.save( self.group, commit = False ) self.group2 = Group.create( self.database.next_id( Group ), self.group_name ) self.database.save( self.group2, commit = False ) self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address ) self.database.save( self.user, commit = False ) self.database.execute( self.user.sql_save_group( self.group.object_id, admin = False ) ) self.user2 = User.create( self.database.next_id( User ), self.username2, self.password2, self.email_address2 ) self.database.save( self.user2, commit = False ) self.database.execute( self.user2.sql_save_group( self.group.object_id, admin = True ) ) self.user3 = User.create( self.database.next_id( User ), self.username3, self.password3, self.email_address3 ) self.database.save( self.user3, commit = False ) self.database.execute( self.user3.sql_save_group( self.group.object_id, admin = False ) ) self.database.commit()
def setUp( self ): Test_controller.setUp( self ) self.notebook = Notebook.create( self.database.next_id( Notebook ), u"my notebook", trash_id = u"foo" ) self.database.save( self.notebook ) self.anon_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes" ) self.database.save( self.anon_notebook ) self.anon_note = Note.create( self.database.next_id( Note ), u"<h3>my note</h3>", notebook_id = self.anon_notebook.object_id, ) self.database.save( self.anon_note ) self.login_note = Note.create( self.database.next_id( Note ), u"<h3>login</h3>", notebook_id = self.anon_notebook.object_id, ) self.database.save( self.login_note ) self.blog_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes blog" ) self.database.save( self.blog_notebook ) self.blog_note = Note.create( self.database.next_id( Note ), u"<h3>my blog entry</h3>", notebook_id = self.blog_notebook.object_id, ) self.database.save( self.blog_note ) self.guide_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes user guide" ) self.database.save( self.guide_notebook ) self.guide_note = Note.create( self.database.next_id( Note ), u"<h3>it's all self-explanatory</h3>", notebook_id = self.guide_notebook.object_id, ) self.database.save( self.guide_note ) self.privacy_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes privacy policy" ) self.database.save( self.privacy_notebook ) self.privacy_note = Note.create( self.database.next_id( Note ), u"<h3>yay privacy</h3>", notebook_id = self.privacy_notebook.object_id, ) self.database.save( self.privacy_note ) self.username = u"mulder" self.password = u"trustno1" self.email_address = u"*****@*****.**" self.user = None self.session_id = None self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address ) self.database.save( self.user ) self.database.execute( self.user.sql_save_notebook( self.notebook.object_id ) ) self.anonymous = User.create( self.database.next_id( User ), u"anonymous" ) self.database.save( self.anonymous ) self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id, read_write = False, owner = False, rank = 0 ) ) self.database.execute( self.anonymous.sql_save_notebook( self.blog_notebook.object_id, read_write = False, owner = False, rank = 1 ) ) self.database.execute( self.anonymous.sql_save_notebook( self.guide_notebook.object_id, read_write = False, owner = False, rank = 2 ) ) self.database.execute( self.anonymous.sql_save_notebook( self.privacy_notebook.object_id, read_write = False, owner = False, rank = 3 ) )
def setUp(self): Test_controller.setUp(self) self.notebook = Notebook.create(self.database.next_id(Notebook), u"my notebook", trash_id=u"foo") self.database.save(self.notebook) self.anon_notebook = Notebook.create(self.database.next_id(Notebook), u"Luminotes", trash_id=u"bar") self.database.save(self.anon_notebook) self.anon_note = Note.create( self.database.next_id(Note), u"<h3>my note</h3>", notebook_id=self.anon_notebook.object_id, ) self.database.save(self.anon_note) self.login_note = Note.create( self.database.next_id(Note), u"<h3>login</h3>", notebook_id=self.anon_notebook.object_id, ) self.database.save(self.login_note) self.username = u"mulder" self.password = u"trustno1" self.email_address = u"*****@*****.**" self.user = None self.session_id = None self.user = User.create(self.database.next_id(User), self.username, self.password, self.email_address) self.database.save(self.user) self.database.execute( self.user.sql_save_notebook(self.notebook.object_id)) self.anonymous = User.create(self.database.next_id(User), u"anonymous") self.database.save(self.anonymous) self.database.execute( self.anonymous.sql_save_notebook(self.anon_notebook.object_id)) self.blog_user = User.create(self.database.next_id(User), u"witten", self.password, self.email_address) self.database.save(self.blog_user) tag_id = self.database.next_id(Tag) self.forum_tag = Tag.create( tag_id, notebook_id= None, # this tag is not in the namespace of a single notebook user_id=self.anonymous.object_id, name=u"forum", description=u"a discussion forum") self.database.save(self.forum_tag) self.general_thread = Notebook.create( self.database.next_id(Notebook), u"Welcome to the general forum!") self.database.save(self.general_thread) self.database.execute( self.anonymous.sql_save_notebook( self.general_thread.object_id, read_write=Notebook.READ_WRITE_FOR_OWN_NOTES), ) self.database.execute( self.anonymous.sql_save_notebook_tag(self.general_thread.object_id, self.forum_tag.object_id, value=u"general"), ) self.support_thread = Notebook.create( self.database.next_id(Notebook), u"Welcome to the support forum!") self.database.save(self.support_thread) self.database.execute( self.anonymous.sql_save_notebook( self.support_thread.object_id, read_write=Notebook.READ_WRITE_FOR_OWN_NOTES), ) self.database.execute( self.anonymous.sql_save_notebook_tag(self.support_thread.object_id, self.forum_tag.object_id, value=u"support"), ) self.blog_thread = Notebook.create(self.database.next_id(Notebook), u"Welcome to the blog!") self.database.save(self.blog_thread) self.database.execute( self.anonymous.sql_save_notebook( self.blog_thread.object_id, read_write=Notebook.READ_WRITE_FOR_OWN_NOTES), ) self.database.execute( self.blog_user.sql_save_notebook(self.blog_thread.object_id, read_write=Notebook.READ_WRITE), ) self.database.execute( self.anonymous.sql_save_notebook_tag(self.blog_thread.object_id, self.forum_tag.object_id, value=u"forum"), )
def setUp(self): Test_controller.setUp(self) self.notebook = Notebook.create(self.database.next_id(Notebook), u"my notebook", trash_id=u"foo") self.database.save(self.notebook) self.anon_notebook = Notebook.create(self.database.next_id(Notebook), u"Luminotes") self.database.save(self.anon_notebook) self.anon_note = Note.create( self.database.next_id(Note), u"<h3>my note</h3>", notebook_id=self.anon_notebook.object_id, ) self.database.save(self.anon_note) self.login_note = Note.create( self.database.next_id(Note), u"<h3>login</h3>", notebook_id=self.anon_notebook.object_id, ) self.database.save(self.login_note) self.blog_notebook = Notebook.create(self.database.next_id(Notebook), u"Luminotes blog") self.database.save(self.blog_notebook) self.blog_note = Note.create( self.database.next_id(Note), u"<h3>my blog entry</h3>", notebook_id=self.blog_notebook.object_id, ) self.database.save(self.blog_note) self.guide_notebook = Notebook.create(self.database.next_id(Notebook), u"Luminotes user guide") self.database.save(self.guide_notebook) self.guide_note = Note.create( self.database.next_id(Note), u"<h3>it's all self-explanatory</h3>", notebook_id=self.guide_notebook.object_id, ) self.database.save(self.guide_note) self.privacy_notebook = Notebook.create( self.database.next_id(Notebook), u"Luminotes privacy policy") self.database.save(self.privacy_notebook) self.privacy_note = Note.create( self.database.next_id(Note), u"<h3>yay privacy</h3>", notebook_id=self.privacy_notebook.object_id, ) self.database.save(self.privacy_note) self.username = u"mulder" self.password = u"trustno1" self.email_address = u"*****@*****.**" self.user = None self.session_id = None self.user = User.create(self.database.next_id(User), self.username, self.password, self.email_address) self.database.save(self.user) self.database.execute( self.user.sql_save_notebook(self.notebook.object_id)) self.anonymous = User.create(self.database.next_id(User), u"anonymous") self.database.save(self.anonymous) self.database.execute( self.anonymous.sql_save_notebook(self.anon_notebook.object_id, read_write=False, owner=False, rank=0)) self.database.execute( self.anonymous.sql_save_notebook(self.blog_notebook.object_id, read_write=False, owner=False, rank=1)) self.database.execute( self.anonymous.sql_save_notebook(self.guide_notebook.object_id, read_write=False, owner=False, rank=2)) self.database.execute( self.anonymous.sql_save_notebook(self.privacy_notebook.object_id, read_write=False, owner=False, rank=3))
def setUp( self ): Test_controller.setUp( self ) self.notebook = Notebook.create( self.database.next_id( Notebook ), u"my notebook", trash_id = u"foo" ) self.database.save( self.notebook ) self.anon_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes", trash_id = u"bar" ) self.database.save( self.anon_notebook ) self.anon_note = Note.create( self.database.next_id( Note ), u"<h3>my note</h3>", notebook_id = self.anon_notebook.object_id, ) self.database.save( self.anon_note ) self.login_note = Note.create( self.database.next_id( Note ), u"<h3>login</h3>", notebook_id = self.anon_notebook.object_id, ) self.database.save( self.login_note ) self.username = u"mulder" self.password = u"trustno1" self.email_address = u"*****@*****.**" self.user = None self.session_id = None self.user = User.create( self.database.next_id( User ), self.username, self.password, self.email_address ) self.database.save( self.user ) self.database.execute( self.user.sql_save_notebook( self.notebook.object_id ) ) self.anonymous = User.create( self.database.next_id( User ), u"anonymous" ) self.database.save( self.anonymous ) self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id ) ) self.blog_user = User.create( self.database.next_id( User ), u"witten", self.password, self.email_address ) self.database.save( self.blog_user ) tag_id = self.database.next_id( Tag ) self.forum_tag = Tag.create( tag_id, notebook_id = None, # this tag is not in the namespace of a single notebook user_id = self.anonymous.object_id, name = u"forum", description = u"a discussion forum" ) self.database.save( self.forum_tag ) self.general_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the general forum!" ) self.database.save( self.general_thread ) self.database.execute( self.anonymous.sql_save_notebook( self.general_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ), ) self.database.execute( self.anonymous.sql_save_notebook_tag( self.general_thread.object_id, self.forum_tag.object_id, value = u"general" ), ) self.support_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the support forum!" ) self.database.save( self.support_thread ) self.database.execute( self.anonymous.sql_save_notebook( self.support_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ), ) self.database.execute( self.anonymous.sql_save_notebook_tag( self.support_thread.object_id, self.forum_tag.object_id, value = u"support" ), ) self.blog_thread = Notebook.create( self.database.next_id( Notebook ), u"Welcome to the blog!" ) self.database.save( self.blog_thread ) self.database.execute( self.anonymous.sql_save_notebook( self.blog_thread.object_id, read_write = Notebook.READ_WRITE_FOR_OWN_NOTES ), ) self.database.execute( self.blog_user.sql_save_notebook( self.blog_thread.object_id, read_write = Notebook.READ_WRITE ), ) self.database.execute( self.anonymous.sql_save_notebook_tag( self.blog_thread.object_id, self.forum_tag.object_id, value = u"forum" ), )