OPSI.ldaptor.test.test_pureber module

Test cases for ldaptor.protocols.pureber module.

class OPSI.ldaptor.test.test_pureber.BERBaseEquality(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

testBERBaseEquality()

BER objects equal BER objects with same type and content

testBERBaseInEquality()

BER objects do not equal BER objects with different type or content

valuesToTest = ((<class OPSI.ldaptor.protocols.pureber.BERInteger>, [0]), (<class OPSI.ldaptor.protocols.pureber.BERInteger>, [1]), (<class OPSI.ldaptor.protocols.pureber.BERInteger>, [4000]), (<class 'OPSI.ldaptor.protocols.pureber.BERSequence'>, [[BERInteger(value=1000), BERInteger(value=2000)]]), (<class 'OPSI.ldaptor.protocols.pureber.BERSequence'>, [[BERInteger(value=2000), BERInteger(value=1000)]]), (<class OPSI.ldaptor.protocols.pureber.BEROctetString>, ['foo']), (<class OPSI.ldaptor.protocols.pureber.BEROctetString>, ['b\xe4\xe4']))
class OPSI.ldaptor.test.test_pureber.BERBooleanKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = ((0, [1, 1, 0], 0), (1, [1, 1, 255], 255), (2, [1, 1, 255], 255), (125, [1, 1, 255], 255), (126, [1, 1, 255], 255), (127, [1, 1, 255], 255), (-1, [1, 1, 255], 255), (-2, [1, 1, 255], 255), (-3, [1, 1, 255], 255), (-126, [1, 1, 255], 255), (-127, [1, 1, 255], 255), (-128, [1, 1, 255], 255), (-129, [1, 1, 255], 255), (-9999, [1, 1, 255], 255), (128, [1, 1, 255], 255), (255, [1, 1, 255], 255), (256, [1, 1, 255], 255), (9999, [1, 1, 255], 255))
testFromBERBooleanKnownValues()

BERBoolean(encoded=”...”) should give known result with known input

testPartialBERBooleanEncodings()

BERBoolean(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBERBooleanKnownValues()

str(BERBoolean(n)) should give known result with known input

class OPSI.ldaptor.test.test_pureber.BEREnumeratedKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = ((0, [10, 1, 0]), (1, [10, 1, 1]), (2, [10, 1, 2]), (125, [10, 1, 125]), (126, [10, 1, 126]), (127, [10, 1, 127]), (-1, [10, 1, 255]), (-2, [10, 1, 254]), (-3, [10, 1, 253]), (-126, [10, 1, 130]), (-127, [10, 1, 129]), (-128, [10, 1, 128]), (-129, [10, 2, 255, 127]), (128, [10, 2, 0, 128]), (256, [10, 2, 1, 0]))
testFromBEREnumeratedKnownValues()

BEREnumerated(encoded=”...”) should give known result with known input

testPartialBEREnumeratedEncodings()

BEREnumerated(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBEREnumeratedKnownValues()

str(BEREnumerated(n)) should give known result with known input

class OPSI.ldaptor.test.test_pureber.BEREnumeratedSanityCheck(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

testSanity()

BEREnumerated(encoded=BEREnumerated(n)).value==n for -1000..1000

class OPSI.ldaptor.test.test_pureber.BERIntegerKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = ((0, [2, 1, 0]), (1, [2, 1, 1]), (2, [2, 1, 2]), (125, [2, 1, 125]), (126, [2, 1, 126]), (127, [2, 1, 127]), (-1, [2, 1, 255]), (-2, [2, 1, 254]), (-3, [2, 1, 253]), (-126, [2, 1, 130]), (-127, [2, 1, 129]), (-128, [2, 1, 128]), (-129, [2, 2, 255, 127]), (128, [2, 2, 0, 128]), (256, [2, 2, 1, 0]))
testFromBERIntegerKnownValues()

BERInteger(encoded=”...”) should give known result with known input

testPartialBERIntegerEncodings()

BERInteger(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBERIntegerKnownValues()

str(BERInteger(n)) should give known result with known input

class OPSI.ldaptor.test.test_pureber.BERIntegerSanityCheck(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

testSanity()

BERInteger(encoded=BERInteger(n)).value==n for -1000..1000

class OPSI.ldaptor.test.test_pureber.BERNullKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

testFromBERNullKnownValues()

BERNull(encoded=”...”) should give known result with known input

testPartialBERNullEncodings()

BERNull(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBERNullKnownValues()

str(BERNull()) should give known result

class OPSI.ldaptor.test.test_pureber.BEROctetStringKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = (('', [4, 0]), ('foo', [4, 3, 102, 111, 111]), ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', [4, 100, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]), (<OPSI.ldaptor.test.test_pureber.ObjectThatCanStringify object>, [4, 3, 98, 97, 114]))
testFromBEROctetStringKnownValues()

BEROctetString(encoded=”...”) should give known result with known input

testPartialBEROctetStringEncodings()

BEROctetString(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBEROctetStringKnownValues()

str(BEROctetString(n)) should give known result with known input

class OPSI.ldaptor.test.test_pureber.BEROctetStringSanityCheck(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

testSanity()

BEROctetString(encoded=BEROctetString(n*’x’)).value==n*’x’ for some values of n

class OPSI.ldaptor.test.test_pureber.BERSequenceKnownValues(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = (([], [48, 0]), ([BERInteger(value=2)], [48, 3, 2, 1, 2]), ([BERInteger(value=3)], [48, 3, 2, 1, 3]), ([BERInteger(value=128)], [48, 4, 2, 2, 0, 128]), ([BERInteger(value=2), BERInteger(value=3), BERInteger(value=128)], [48, 10, 2, 1, 2, 2, 1, 3, 2, 2, 0, 128]))
testFromBERSequenceKnownValues()

BERSequence(encoded=”...”) should give known result with known input

testPartialBERSequenceEncodings()

BERSequence(encoded=”...”) with too short input should throw BERExceptionInsufficientData

testToBERSequenceKnownValues()

str(BERSequence(x)) should give known result with known input

class OPSI.ldaptor.test.test_pureber.BerLengths(methodName='runTest')

Bases: twisted.trial._asynctest.TestCase

knownValues = ((0, [0]), (1, [1]), (100, [100]), (126, [126]), (127, [127]), (128, [129, 128]), (129, [129, 129]), (255, [129, 255]), (256, [130, 1, 0]), (257, [130, 1, 1]), (65535, [130, 255, 255]), (65536, [131, 1, 0, 0]), (702223880805592151456759840151962786569522257399338504974336254522393264865238137237142489540654437582500444843247630303354647534431314931612685275935445798350655833690880801860555545317367555154113605281582053784524026102900245630757473088050106395169337932361665227499793929447186391815763110662594625535L, [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]))
testFromBER()
testPartialBER()
testToBER()
class OPSI.ldaptor.test.test_pureber.ObjectThatCanStringify

Bases: object

OPSI.ldaptor.test.test_pureber.l(s)

Split a string to ord’s of chars.

OPSI.ldaptor.test.test_pureber.s(*l)

Join all members of list to a string. Integer members are chr()ed