Changeset 7333 for main/waeup.sirp/trunk/src/waeup/sirp/university/tests
- Timestamp:
- 12 Dec 2011, 07:01:54 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/university/tests
- Files:
-
- 1 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_certificatescontainer.py
r7331 r7333 30 30 FunctionalLayer, doctestsuite_for_module, FunctionalTestCase) 31 31 from waeup.sirp.university.certificate import Certificate 32 from waeup.sirp.university.certificate container import CertificateContainer33 from waeup.sirp.university.interfaces import ICertificate Container32 from waeup.sirp.university.certificatescontainer import CertificatesContainer 33 from waeup.sirp.university.interfaces import ICertificatesContainer 34 34 35 35 36 class Certificate ContainerTests(FunctionalTestCase):36 class CertificatesContainerTests(FunctionalTestCase): 37 37 38 38 layer = FunctionalLayer 39 39 40 40 def setUp(self): 41 super(Certificate ContainerTests, self).setUp()41 super(CertificatesContainerTests, self).setUp() 42 42 43 43 # Setup a sample site for each test … … 52 52 53 53 def tearDown(self): 54 super(Certificate ContainerTests, self).tearDown()54 super(CertificatesContainerTests, self).tearDown() 55 55 clearSite() 56 56 shutil.rmtree(self.dc_root) … … 58 58 def test_create(self): 59 59 # we can create instances 60 container = Certificate Container()61 result = isinstance(container, Certificate Container)60 container = CertificatesContainer() 61 result = isinstance(container, CertificatesContainer) 62 62 assert result is True 63 63 64 def test_provides_icertificate container(self):64 def test_provides_icertificatescontainer(self): 65 65 # instances tell they provide their main interface 66 container = Certificate Container()67 result = ICertificate Container.providedBy(container)66 container = CertificatesContainer() 67 result = ICertificatesContainer.providedBy(container) 68 68 assert result is True 69 69 70 70 def test_interfaces(self): 71 71 # class and instances comply with their main interface 72 container = Certificate Container()73 self.assertTrue(verifyClass(ICertificate Container, CertificateContainer))74 self.assertTrue(verifyObject(ICertificate Container, container))72 container = CertificatesContainer() 73 self.assertTrue(verifyClass(ICertificatesContainer, CertificatesContainer)) 74 self.assertTrue(verifyObject(ICertificatesContainer, container)) 75 75 76 76 def test_add_certificate_non_icertificate(self): 77 77 # we cannot add certificates that do not implement ICertificate. 78 container = Certificate Container()78 container = CertificatesContainer() 79 79 self.assertRaises( 80 80 TypeError, container.addCertificate, 'some_string') … … 82 82 def test_add_certificate_no_duplicate_entry(self): 83 83 # we cannot add certificates that are registered already. 84 container = Certificate Container()84 container = CertificatesContainer() 85 85 # We must place this container in the ZODB to make catalogs work. 86 86 self.app['certs'] = container … … 94 94 def test_setitem_duplicate_entry(self): 95 95 # we cannot add certificates whose code exists already in catalog 96 container1 = Certificate Container()97 container2 = Certificate Container()96 container1 = CertificatesContainer() 97 container2 = CertificatesContainer() 98 98 self.app['certs1'] = container1 # enable catalogs 99 99 self.app['certs2'] = container2 … … 108 108 def test_setitem_name_unequal_code(self): 109 109 # we cannot add certificates whose code != key 110 container = Certificate Container()110 container = CertificatesContainer() 111 111 self.app['certs'] = container # enable catalogs 112 112 cert1 = Certificate(code="CERT1") … … 118 118 def test_clear(self): 119 119 # clear() really empties the container. 120 container = Certificate Container()120 container = CertificatesContainer() 121 121 self.app['certs'] = container # enable catalogs 122 122 cert1 = Certificate(code="CERT1") … … 130 130 def test_suite(): 131 131 suite = unittest.TestSuite(( 132 unittest.makeSuite(Certificate ContainerTests),132 unittest.makeSuite(CertificatesContainerTests), 133 133 doctestsuite_for_module( 134 'waeup.sirp.university.certificate container'),134 'waeup.sirp.university.certificatescontainer'), 135 135 )) 136 136 return suite -
main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_coursescontainer.py
r7331 r7333 21 21 import unittest 22 22 from zope.interface.verify import verifyClass, verifyObject 23 from waeup.sirp.university.interfaces import ICourse Container24 from waeup.sirp.university import Course Container, Course23 from waeup.sirp.university.interfaces import ICoursesContainer 24 from waeup.sirp.university import CoursesContainer, Course 25 25 26 class Course ContainerTests(unittest.TestCase):26 class CoursesContainerTests(unittest.TestCase): 27 27 28 28 def test_ifaces(self): 29 container = Course Container()30 self.assertTrue(verifyClass(ICourse Container, CourseContainer))31 self.assertTrue(verifyObject(ICourse Container, container))29 container = CoursesContainer() 30 self.assertTrue(verifyClass(ICoursesContainer, CoursesContainer)) 31 self.assertTrue(verifyObject(ICoursesContainer, container)) 32 32 33 33 def test_setitem_name_ne_code(self): 34 34 # If we add a course under a wrong name that will give an error 35 container = Course Container()35 container = CoursesContainer() 36 36 course = Course(code='MYCOURSE') 37 37 self.assertRaises( -
main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_facultiescontainer.py
r7331 r7333 17 17 ## 18 18 19 # Tests for Facult yContainer.19 # Tests for FacultiesContainer. 20 20 import logging 21 21 import unittest … … 23 23 from zope.interface.verify import verifyObject, verifyClass 24 24 from waeup.sirp.testing import FunctionalTestCase, FunctionalLayer 25 from waeup.sirp.university.interfaces import IFacult yContainer26 from waeup.sirp.university import Facult yContainer27 from waeup.sirp.university.facult ycontainer import AcademicsPlugin25 from waeup.sirp.university.interfaces import IFacultiesContainer 26 from waeup.sirp.university import FacultiesContainer 27 from waeup.sirp.university.facultiescontainer import AcademicsPlugin 28 28 29 29 class FakeLogger(object): … … 54 54 return result 55 55 56 class Facult yContainerTests(unittest.TestCase):56 class FacultiesContainerTests(unittest.TestCase): 57 57 58 58 def test_ifaces(self): 59 container = Facult yContainer()60 self.assertTrue(verifyClass(IFacult yContainer, FacultyContainer))61 self.assertTrue(verifyObject(IFacult yContainer, container))59 container = FacultiesContainer() 60 self.assertTrue(verifyClass(IFacultiesContainer, FacultiesContainer)) 61 self.assertTrue(verifyObject(IFacultiesContainer, container)) 62 62 63 63 class AcademicsPluginTests(unittest.TestCase): … … 76 76 plugin.setup(site, 'testsite', logger) 77 77 self.assertTrue('faculties' in site.keys()) 78 self.assertTrue(isinstance(site['faculties'], Facult yContainer))78 self.assertTrue(isinstance(site['faculties'], FacultiesContainer)) 79 79 self.assertEqual( 80 80 self._logger_factory.get_messages(), 81 'C reated faculty container for University\n'81 'Container for faculties created\n' 82 82 ) 83 83 … … 90 90 self.assertEqual( 91 91 self._logger_factory.get_messages(), 92 'Could not create faculty containerin SIRP.\n'92 'Could not create container for faculties in SIRP.\n' 93 93 ) 94 94 … … 99 99 plugin.update(site, 'testsite', logger) 100 100 self.assertTrue('faculties' in site.keys()) 101 self.assertTrue(isinstance(site['faculties'], Facult yContainer))101 self.assertTrue(isinstance(site['faculties'], FacultiesContainer)) 102 102 self.assertEqual( 103 103 self._logger_factory.get_messages(), 104 'C reated faculty container for University\n'104 'Container for faculties created\n' 105 105 ) 106 106 -
main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_university.py
r7195 r7333 27 27 names = globals().keys() 28 28 self.assertTrue('Course' in names) 29 self.assertTrue('Course Container' in names)29 self.assertTrue('CoursesContainer' in names) 30 30 self.assertTrue('Faculty' in names) 31 self.assertTrue('Facult yContainer' in names)31 self.assertTrue('FacultiesContainer' in names) 32 32 33 33 def test_suite():
Note: See TracChangeset for help on using the changeset viewer.