コード例 #1
0
ファイル: test_pureber.py プロジェクト: wiml/ldaptor
 def testToBERBooleanKnownValues(self):
     """str(BERBoolean(n)) should give known result with known input"""
     for integer, encoded, dummy in self.knownValues:
         result = pureber.BERBoolean(integer)
         result = str(result)
         result = list(map(ord, result))
         self.assertEqual(encoded, result)
コード例 #2
0
ファイル: test_pureber.py プロジェクト: shivram2609/ldaptor
 def testToBERBooleanKnownValues(self):
     """BERBoolean(n).toWire() should give known result with known input"""
     for integer, encoded, dummy in self.knownValues:
         result = pureber.BERBoolean(integer)
         result = result.toWire()
         result = l(result)
         self.assertEqual(encoded, result)
コード例 #3
0
ファイル: test_pureber.py プロジェクト: tonich-sh/ldaptor
 def testPartialBERBooleanEncodings(self):
     """BERBoolean(encoded="...") with too short input should throw BERExceptionInsufficientData"""
     m=str(pureber.BERBoolean(42))
     assert len(m)==3
     self.assertRaises(pureber.BERExceptionInsufficientData, pureber.berDecodeObject, pureber.BERDecoderContext(), m[:2])
     self.assertRaises(pureber.BERExceptionInsufficientData, pureber.berDecodeObject, pureber.BERDecoderContext(), m[:1])
     self.assertEquals((None, 0), pureber.berDecodeObject(pureber.BERDecoderContext(), ''))
コード例 #4
0
ファイル: test_pureber.py プロジェクト: shivram2609/ldaptor
 def testPartialBERBooleanEncodings(self):
     """BERBoolean(encoded="...") with too short input should throw BERExceptionInsufficientData"""
     m = pureber.BERBoolean(42).toWire()
     self.assertEqual(3, len(m))
     self.assertRaises(
         pureber.BERExceptionInsufficientData,
         pureber.berDecodeObject,
         pureber.BERDecoderContext(),
         m[:2],
     )
     self.assertRaises(
         pureber.BERExceptionInsufficientData,
         pureber.berDecodeObject,
         pureber.BERDecoderContext(),
         m[:1],
     )
     self.assertEqual((None, 0),
                      pureber.berDecodeObject(pureber.BERDecoderContext(),
                                              ""))