From baf529de6da16b6ee9358e9403359cfaa7113aa6 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 4 Nov 2008 12:50:06 -0800 Subject: [PATCH] Unit test for forum redirect in controller.Notebooks.default(). --- controller/test/Test_notebooks.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/controller/test/Test_notebooks.py b/controller/test/Test_notebooks.py index 49818c3..8329bba 100644 --- a/controller/test/Test_notebooks.py +++ b/controller/test/Test_notebooks.py @@ -165,6 +165,33 @@ class Test_notebooks( Test_controller ): user = self.database.load( User, self.user.object_id ) assert user.storage_bytes == 0 + def test_default_forum( self ): + self.login() + + tag_id = self.database.next_id( Tag, commit = False ) + new_tag = Tag.create( + tag_id, + notebook_id = None, # this tag is not in the namespace of a single notebook + user_id = self.user.object_id, + name = u"forum", + description = u"a discussion forum" + ) + self.database.save( new_tag, commit = False ) + + self.database.execute( + self.user.sql_save_notebook_tag( self.notebook.object_id, new_tag.object_id, value = u"chickens" ), + commit = False, + ) + self.database.commit() + + result = self.http_get( + "/notebooks/%s" % self.notebook.object_id, + session_id = self.session_id, + ) + + redirect = result.get( "redirect" ) + assert redirect == u"/forums/chickens/%s" % self.notebook.object_id + def test_default( self ): self.login()