aboutsummaryrefslogtreecommitdiff
blob: 0063fddd65010c237589ab674066b9a185747265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
"""
    grumpy.testsuite.usermodel
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Various user handling unittests.

    :copyright: (c) by 2010 Priit Laes.
    :license: BSD, see LICENSE for details.
"""
from . import GrumpyTestCase

from grumpy.models import User

import unittest

class UserModelTestCase(GrumpyTestCase):

    def make_users(self):
        self.db.session.add_all([\
            User('user1@gentoo.org', 'http://example.net/openid1'),
            User('user2@gentoo.org', 'http://example.net/openid2')])
        self.db.session.commit()

    def test_user_creation(self):
        with self.app.test_request_context():
            self.make_users()
            assert User.query.count() == 2

def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(UserModelTestCase))
    return suite