tests/app/soc/views/sidebar/test_sidebar.py
author Sverre Rabbelier <srabbelier@gmail.com>
Tue, 27 Jan 2009 11:15:49 +0000
changeset 1009 7abbbfc79f3a
child 1027 9633a6a5e5f9
permissions -rw-r--r--
Added some very basic tests for the sidebar and access modules Also updated run.py to set the USER_EMAIL variable. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1009
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
__authors__ = [
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
  ]
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
import unittest
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from google.appengine.api import users
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from google.appengine.api import memcache
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
from soc.views.sitemap import sidebar
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
class SidebarTest(unittest.TestCase):
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
  def setUp(self):
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
    pass
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  def testSidebarCallbacksAreAdded(self):
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
    """Test that the sidebar callbacks are added when importing 'build'
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
    """
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
    self.assertEqual([], sidebar.SIDEBAR)
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
    from soc.views.sitemap import build
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
    self.assertNotEqual([], sidebar.SIDEBAR)
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  def testSidebarBuilds(self):
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
    """test that the sidebar builds and does not return None
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
    """
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
7abbbfc79f3a Added some very basic tests for the sidebar and access modules
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
    self.assertNotEqual(None, sidebar.getSidebar())