示例#1
0
    def test_listTestCases_simple( self ):

        _TEST_IDS = ( 'test_one'
                    , 'test_two'
                    , 'test_three'
                    )

        zuite = self._makeOne()

        for test_id in _TEST_IDS:
            zuite._setObject( test_id, self._makeFile( test_id ) )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.failUnless( case[ 'id' ] in _TEST_IDS )

        zuite.test_case_metatypes = ()
        self.assertEqual( len( zuite.listTestCases() ), 0 )

        zuite.test_case_metatypes = ( 'File', )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.failUnless( case[ 'id' ] in _TEST_IDS )
示例#2
0
    def test_listTestCases_simple( self ):

        _TEST_IDS = ( 'test_one'
                    , 'test_two'
                    , 'test_three'
                    )

        zuite = self._makeOne()

        for test_id in _TEST_IDS:
            zuite._setObject( test_id, self._makeFile( test_id ) )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.assertTrue( case[ 'id' ] in _TEST_IDS )

        zuite.test_case_metatypes = ()
        self.assertEqual( len( zuite.listTestCases() ), 0 )

        zuite.test_case_metatypes = ( 'File', )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.assertTrue( case[ 'id' ] in _TEST_IDS )
示例#3
0
    def test_empty( self ):

        zuite = self._makeOne()
        self.assertEqual( len( zuite.test_case_metatypes ), 2 )
        self.assertTrue( 'File' in zuite.test_case_metatypes )
        self.assertTrue( 'Page Template' in zuite.test_case_metatypes )
        self.assertEqual( len( zuite.listTestCases() ), 0 )
示例#4
0
    def test_empty( self ):

        zuite = self._makeOne()
        self.assertEqual( len( zuite.test_case_metatypes ), 2 )
        self.failUnless( 'File' in zuite.test_case_metatypes )
        self.failUnless( 'Page Template' in zuite.test_case_metatypes )
        self.assertEqual( len( zuite.listTestCases() ), 0 )
示例#5
0
    def test_listTestCases_recursive( self ):

        _TEST_IDS = ( 'test_one'
                    , 'test_two'
                    , 'test_three'
                    )

        _SUB_IDS = tuple( [ x + '_sub' for x in _TEST_IDS[:-1] ] )

        # Create a zuite inside a zuite, each populated with testcases.
        zuite = self._makeOne()

        for test_id in _TEST_IDS:
            zuite._setObject( test_id, self._makeFile( test_id ) )

        sub = self._makeOne()

        for sub_id in _SUB_IDS:
            sub._setObject( sub_id, self._makeFile( sub_id ) )

        zuite._setObject( 'sub', sub )

        # verify that the default settings pick up all tests.
        cases = zuite.listTestCases()
        expected = _TEST_IDS + _SUB_IDS
        self.assertEqual( len( cases ), len( expected ) )
        for case in cases:
            self.assertTrue( case[ 'id' ] in expected )

        # verfiy that disabling the parent's metatypes leaves the child's OK.
        zuite.test_case_metatypes = ()
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _SUB_IDS ) )
        for case in cases:
            self.assertTrue( case[ 'id' ] in _SUB_IDS )

        # verfiy that disabling the child's metatypes leaves the parent's OK.
        zuite.test_case_metatypes = ( 'File', )
        sub.test_case_metatypes = ()
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.assertTrue( case[ 'id' ] in _TEST_IDS )
示例#6
0
    def test_listTestCases_recursive( self ):

        _TEST_IDS = ( 'test_one'
                    , 'test_two'
                    , 'test_three'
                    )

        _SUB_IDS = tuple( [ x + '_sub' for x in _TEST_IDS[:-1] ] )

        # Create a zuite inside a zuite, each populated with testcases.
        zuite = self._makeOne()

        for test_id in _TEST_IDS:
            zuite._setObject( test_id, self._makeFile( test_id ) )

        sub = self._makeOne()

        for sub_id in _SUB_IDS:
            sub._setObject( sub_id, self._makeFile( sub_id ) )

        zuite._setObject( 'sub', sub )

        # verify that the default settings pick up all tests.
        cases = zuite.listTestCases()
        expected = _TEST_IDS + _SUB_IDS
        self.assertEqual( len( cases ), len( expected ) )
        for case in cases:
            self.failUnless( case[ 'id' ] in expected )

        # verfiy that disabling the parent's metatypes leaves the child's OK.
        zuite.test_case_metatypes = ()
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _SUB_IDS ) )
        for case in cases:
            self.failUnless( case[ 'id' ] in _SUB_IDS )

        # verfiy that disabling the child's metatypes leaves the parent's OK.
        zuite.test_case_metatypes = ( 'File', )
        sub.test_case_metatypes = ()
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), len( _TEST_IDS ) )
        for case in cases:
            self.failUnless( case[ 'id' ] in _TEST_IDS )
示例#7
0
    def test_listTestCases_filesystem(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'flat'))

        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 1)
        self.assertEqual(cases[0]['id'], 'test_simple.html')
示例#8
0
    def test_listTestCases_filesystem_recursive(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'nested'))

        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertTrue('test_one.html' in case_ids)
        self.assertTrue('test_another.html' in case_ids)
示例#9
0
    def test_listTestCases_filesystem( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'flat'
                                           )
                             )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 1 )
        self.assertEqual( cases[ 0 ][ 'id' ], 'test_simple.html' )
示例#10
0
    def test_listTestCases_filesystem_ordered_explicit(self):

        # Use the ordering specified in '.objects'.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty(
            'filesystem_path',
            os.path.join(package_home(globals()), 'ordered', 'explicit'))
        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertEqual(case_ids[0], 'test_beta.html')
        self.assertEqual(case_ids[1], 'test_alpha.html')
示例#11
0
    def test_listTestCases_filesystem_ordered_default(self):

        # By default, sort alphabetically.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty(
            'filesystem_path',
            os.path.join(package_home(globals()), 'ordered', 'default'))
        cases = zuite.listTestCases()
        self.assertEqual(len(cases), 2)
        case_ids = [x['id'] for x in cases]
        self.assertEqual(case_ids[0], 'test_alpha.html')
        self.assertEqual(case_ids[1], 'test_beta.html')
示例#12
0
    def test_listTestCases_filesystem_recursive_explicit(self):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty('filesystem_path',
                              os.path.join(package_home(globals()), 'fussy'))
        cases = zuite.listTestCases()
        case_ids = [x['id'] for x in cases]
        self.assertEqual(len(case_ids), 5, case_ids)
        self.assertEqual(case_ids[0], 'test_niece1.html')
        self.assertEqual(case_ids[1], 'test_niece2.html')
        self.assertEqual(case_ids[2], 'test_uncle.html')
        self.assertEqual(case_ids[3], 'test_nephew2.html')
        self.assertEqual(case_ids[4], 'test_nephew1.html')
示例#13
0
    def test_listTestCases_filesystem_recursive( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'nested'
                                           )
                             )

        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.failUnless( 'test_one.html' in case_ids )
        self.failUnless( 'test_another.html' in case_ids )
示例#14
0
    def test_listTestCases_filesystem_ordered_explicit( self ):

        # Use the ordering specified in '.objects'.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'ordered'
                                           , 'explicit'
                                           )
                             )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( case_ids[ 0 ], 'test_beta.html' )
        self.assertEqual( case_ids[ 1 ], 'test_alpha.html' )
示例#15
0
    def test_listTestCases_filesystem_ordered_default( self ):

        # By default, sort alphabetically.
        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'ordered'
                                           , 'default'
                                           )
                             )
        cases = zuite.listTestCases()
        self.assertEqual( len( cases ), 2 )
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( case_ids[ 0 ], 'test_alpha.html' )
        self.assertEqual( case_ids[ 1 ], 'test_beta.html' )
示例#16
0
    def test_listTestCases_filesystem_recursive_explicit( self ):

        import os
        from App.Common import package_home

        zuite = self._makeOne()
        zuite._updateProperty( 'filesystem_path'
                             , os.path.join( package_home( globals() )
                                           , 'fussy'
                                           )
                             )
        cases = zuite.listTestCases()
        case_ids = [ x[ 'id' ] for x in cases ]
        self.assertEqual( len( case_ids ), 5, case_ids )
        self.assertEqual( case_ids[ 0 ], 'test_niece1.html' )
        self.assertEqual( case_ids[ 1 ], 'test_niece2.html' )
        self.assertEqual( case_ids[ 2 ], 'test_uncle.html' )
        self.assertEqual( case_ids[ 3 ], 'test_nephew2.html' )
        self.assertEqual( case_ids[ 4 ], 'test_nephew1.html' )