Logo Search packages:      
Sourcecode: zope-groupuserfolder version File versions

def zope-groupuserfolder-3.1.1::tests::testInterface::TestInterface::test03ClassSecurityInfo (   self  )  [inherited]

This method tests that each and every method has a ClassSecurityInfo() declaration
XXX This doesn't walk through inheritance :(

Definition at line 125 of file testInterface.py.

00125                                      :
        """
        This method tests that each and every method has a ClassSecurityInfo() declaration
        XXX This doesn't walk through inheritance :(
        """
        not_defined = []
        count = 0
        
        # Check interface for each and every class
        ignore = getattr(self, "ignore_interfaces", [])
        for klass in self.klasses:
            dict = dir(klass)
            intfs = getattr(klass, "__implements__", None)
            self.failUnless(intfs, "'%s' class doesn't implement an interface!" % (klass.__name__, ))

            # Flatten interfaces
            intfs = flattenInterfaces(intfs)
            
            # Now check the resulting class to see if the mapping was made
            # correctly. Note that this uses carnal knowledge of the internal
            # structures used to store this information!
            # Check each method of every interface
            for intf in intfs:
                if intf in ignore:
                    continue
                for name in intf.names():
                    count += 1
                    if not "%s__roles__" % (name,) in dict:
                        not_defined.append("%s.%s" % (klass.__name__, name))

        # Raise in case some tests are missing
        if not_defined:
            raise RuntimeError, "%d (over %d) MISSING SECURITY DECLARATIONS:\n%s do not have a security declaration associated." % (
                len(not_defined),
                count,
                string.join(not_defined, ", "),
                )
        
        


Generated by  Doxygen 1.6.0   Back to index