summaryrefslogtreecommitdiffstats
path: root/israwhidebroken/tests
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-09-10 13:36:17 -0400
committerWill Woods <wwoods@redhat.com>2009-09-10 13:36:17 -0400
commit7225cbcc1fcca4c63635f39909ca2ad8711cf1e8 (patch)
treea88955c1ec02bfc0d0465d832f8c0e81748c1784 /israwhidebroken/tests
downloadisrawhidebroken-7225cbcc1fcca4c63635f39909ca2ad8711cf1e8.tar.gz
israwhidebroken-7225cbcc1fcca4c63635f39909ca2ad8711cf1e8.tar.xz
israwhidebroken-7225cbcc1fcca4c63635f39909ca2ad8711cf1e8.zip
Initial import of quickstarted project
Diffstat (limited to 'israwhidebroken/tests')
-rw-r--r--israwhidebroken/tests/__init__.py0
-rw-r--r--israwhidebroken/tests/__init__.pyobin0 -> 181 bytes
-rw-r--r--israwhidebroken/tests/test_controllers.py37
-rw-r--r--israwhidebroken/tests/test_model.py22
4 files changed, 59 insertions, 0 deletions
diff --git a/israwhidebroken/tests/__init__.py b/israwhidebroken/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/israwhidebroken/tests/__init__.py
diff --git a/israwhidebroken/tests/__init__.pyo b/israwhidebroken/tests/__init__.pyo
new file mode 100644
index 0000000..5e0013b
--- /dev/null
+++ b/israwhidebroken/tests/__init__.pyo
Binary files differ
diff --git a/israwhidebroken/tests/test_controllers.py b/israwhidebroken/tests/test_controllers.py
new file mode 100644
index 0000000..7a0648a
--- /dev/null
+++ b/israwhidebroken/tests/test_controllers.py
@@ -0,0 +1,37 @@
+import unittest
+import turbogears
+from turbogears import testutil
+from israwhidebroken.controllers import Root
+import cherrypy
+
+cherrypy.root = Root()
+
+class TestPages(unittest.TestCase):
+
+ def setUp(self):
+ turbogears.startup.startTurboGears()
+
+ def tearDown(self):
+ """Tests for apps using identity need to stop CP/TG after each test to
+ stop the VisitManager thread.
+ See http://trac.turbogears.org/turbogears/ticket/1217 for details.
+ """
+ turbogears.startup.stopTurboGears()
+
+ def test_method(self):
+ "the index method should return a string called now"
+ import types
+ result = testutil.call(cherrypy.root.index)
+ assert type(result["now"]) == types.StringType
+
+ def test_indextitle(self):
+ "The indexpage should have the right title"
+ testutil.create_request("/")
+ response = cherrypy.response.body[0].lower()
+ assert "<title>welcome to turbogears</title>" in response
+
+ def test_logintitle(self):
+ "login page should have the right title"
+ testutil.create_request("/login")
+ response = cherrypy.response.body[0].lower()
+ assert "<title>login</title>" in response
diff --git a/israwhidebroken/tests/test_model.py b/israwhidebroken/tests/test_model.py
new file mode 100644
index 0000000..4c00069
--- /dev/null
+++ b/israwhidebroken/tests/test_model.py
@@ -0,0 +1,22 @@
+# If your project uses a database, you can set up database tests
+# similar to what you see below. Be sure to set the db_uri to
+# an appropriate uri for your testing database. sqlite is a good
+# choice for testing, because you can use an in-memory database
+# which is very fast.
+
+from turbogears import testutil, database
+# from israwhidebroken.model import YourDataClass, User
+
+# database.set_db_uri("sqlite:///:memory:")
+
+# class TestUser(testutil.DBTest):
+# def get_model(self):
+# return User
+# def test_creation(self):
+# "Object creation should set the name"
+# obj = User(user_name = "creosote",
+# email_address = "spam@python.not",
+# display_name = "Mr Creosote",
+# password = "Wafer-thin Mint")
+# assert obj.display_name == "Mr Creosote"
+