Package tests :: Module test_crate
[hide private]
[frames] | no frames]

Source Code for Module tests.test_crate

 1  #!/usr/bin/env python 
 2   
 3  #   This file is part of PARPG. 
 4   
 5  #   PARPG is free software: you can redistribute it and/or modify 
 6  #   it under the terms of the GNU General Public License as published by 
 7  #   the Free Software Foundation, either version 3 of the License, or 
 8  #   (at your option) any later version. 
 9   
10  #   PARPG is distributed in the hope that it will be useful, 
11  #   but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
13  #   GNU General Public License for more details. 
14   
15  #   You should have received a copy of the GNU General Public License 
16  #   along with PARPG.  If not, see <http://www.gnu.org/licenses/>. 
17   
18  import unittest 
19  from parpg.objects.containers import WoodenCrate 
20   
21 -class TestWoodenCrate(unittest.TestCase):
22 - def setUp(self):
23 self.crate = WoodenCrate(ID='crate01') 24 self.crate2 = WoodenCrate(ID='crate02', locked=True)
25
26 - def testCreation(self):
27 """ Test the WoodenCrate creation""" 28 self.assertEqual(self.crate.ID, 'crate01') 29 self.assertEqual(self.crate.name, 'Wooden Crate') 30 self.assertEqual(self.crate.text, 'A battered crate') 31 self.assertEqual(self.crate.gfx, 'crate') 32 self.assertEqual(self.crate.coords, (0.0, 0.0)) 33 self.assertEqual(self.crate.map_id, None) 34 self.assertEqual(self.crate.blocking, True) 35 self.assertEqual(self.crate.is_open, True) 36 self.assertEqual(self.crate.locked, False) 37 self.assertEqual(self.crate.parpg, {}) 38 39 self.assertEqual(self.crate2.ID, 'crate02') 40 self.assertEqual(self.crate2.locked, True)
41 42 # can't test containing functionality...there are no containable objects 43
44 - def testLockable(self):
45 """ Test the WoodenCrate lockability""" 46 self.crate.lock() 47 self.assertEqual(self.crate.locked, True) 48 self.crate.unlock() 49 self.assertEqual(self.crate.locked, False)
50