source: WAeUP_SRP/trunk/tests/test_tables.py @ 17946

Last change on this file since 17946 was 404, checked in by joachim, 18 years ago

accommodation startet

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1# (C) Copyright 2006 AixtraWare <http://aixtraware.de>
2# Author: Joachim Schmitz <js@aixtraware.de>
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License version 2 as published
6# by the Free Software Foundation.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16# 02111-1307, USA.
17#
18# $Id: test_tables.py 404 2006-08-22 21:45:50Z joachim $
19import unittest
20
21from waeuptest import WAeUP_SRPTest
22
23class TestTables(WAeUP_SRPTest):
24   
25    # Test that data does not go away on reinstall
26    def test_install(self):
27        # Make sure the table got installed properly
28        patool = self.portal.portal_accommodation
29        self.failUnlessEqual(patool.meta_type, 'WAeUP Accommodation Tool')
30        self.failUnlessEqual(patool.schema(), ['bed', 'student'])
31        self.failUnlessEqual(patool.indexes(), ['bed', 'student'])
32       
33    def test_add_change_delete(self):
34        patool = self.portal.portal_accommodation
35       
36        # Add
37        uid = patool.addRecord(bed='bed', student='student')
38        result = patool.searchResults({'bed':'bed'})
39        self.failUnlessEqual(len(result), 1)
40        self.failUnlessEqual(result[0].student, 'student')
41       
42        # Change
43        patool.modifyRecord(uid, student='newstudent')
44        result = patool.searchResults({'bed':'bed'})
45        self.failUnlessEqual(len(result), 1)
46        self.failUnlessEqual(result[0].student, 'newstudent')
47       
48        # Delete
49        patool.deleteRecord(uid)
50        result = patool.searchResults({'bed':'bed'})
51        self.failUnlessEqual(len(result), 0)
52   
53
54def test_suite():
55    return unittest.TestSuite((
56        unittest.makeSuite(TestTables),
57        ))
Note: See TracBrowser for help on using the repository browser.