Exemplo n.º 1
0
# or if you have trial installed (from twisted), use
#
#    trial samba.tests.dcerpc.rpc_talloc

"""Tests for the talloc handling in the generated Python DCE/RPC bindings."""

import sys

sys.path.insert(0, "bin/python")

import samba
import samba.tests
from samba.dcerpc import drsuapi
import talloc

talloc.enable_null_tracking()

class TallocTests(samba.tests.TestCase):
    '''test talloc behaviour of pidl generated python code'''

    def check_blocks(self, object, num_expected):
        '''check that the number of allocated blocks is correct'''
        nblocks = talloc.total_blocks(object)
        if object is None:
            nblocks -= self.initial_blocks
        self.assertEquals(nblocks, num_expected)

    def get_rodc_partial_attribute_set(self):
        '''get a list of attributes for RODC replication'''
        partial_attribute_set = drsuapi.DsPartialAttributeSet()
Exemplo n.º 2
0
 def setUp(self):
     super(StringTests, self).setUp()
     talloc.enable_null_tracking()
     self.startup_blocks = talloc.total_blocks()
Exemplo n.º 3
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
import sys

sys.path.insert(0, "bin/python")

import samba
import samba.tests
from samba.dcerpc import drsuapi
import talloc

talloc.enable_null_tracking()

class RpcTests(object):
    '''test type behaviour of pidl generated python RPC code'''

    def check_blocks(self, object, num_expected):
        '''check that the number of allocated blocks is correct'''
        nblocks = talloc.total_blocks(object)
        if object is None:
            nblocks -= self.initial_blocks
        leaked_blocks = (nblocks - num_expected)
        if leaked_blocks != 0:
            print "Leaked %d blocks" % leaked_blocks

    def check_type(self, interface, typename, type):
        print "Checking type %s" % typename
Exemplo n.º 4
0
 def setUp(self):
     super(ArrayTests, self).setUp()
     talloc.enable_null_tracking()
     self.startup_blocks = talloc.total_blocks()