source: web/old/test_models.py @ b349e5d

debianmacno-cupsweb
Last change on this file since b349e5d was 30beeab, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Remove "gutenbach-" from directory names and rename "gutenbach" to "gutenbach-server"

  • Property mode set to 100644
File size: 1.3 KB
Line 
1# -*- coding: utf-8 -*-
2"""Test suite for the TG app's models"""
3
4from tg.testutil import DBTest
5from nose.tools import eq_
6
7from sipbmp3web import model
8
9
10class TestModel(DBTest):
11    """The base class for testing models in you TG project."""
12    model = model
13
14class TestUser(TestModel):
15    """Test case for the User model."""
16   
17    def setUp(self):
18        super(TestUser, self).setUp()
19        self.member = model.User()
20        self.member.user_name = u"ignucius"
21        self.member.email_address = u"ignucius@example.org"
22       
23    def test_member_creation_username(self):
24        """The member constructor must set the user name right"""
25        eq_(self.member.user_name, u"ignucius")
26       
27    def test_member_creation_email(self):
28        """The member constructor must set the email right"""
29        eq_(self.member.email_address, u"ignucius@example.org")
30   
31    def test_no_permissions_by_default(self):
32        """User objects should have no permission by default."""
33        eq_(len(self.member.permissions), 0)
34       
35    def test_getting_by_email(self):
36        """Users should be fetcheable by their email addresses"""
37        model.DBSession.add(self.member)
38        him = model.User.by_email_address(u"ignucius@example.org")
39        eq_(him, self.member)
Note: See TracBrowser for help on using the repository browser.