diff options
Diffstat (limited to 'tests/codec/ber/test_encoder.py')
-rw-r--r-- | tests/codec/ber/test_encoder.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/codec/ber/test_encoder.py b/tests/codec/ber/test_encoder.py index 78cb841..ba91919 100644 --- a/tests/codec/ber/test_encoder.py +++ b/tests/codec/ber/test_encoder.py @@ -436,18 +436,39 @@ if sys.version_info[0:2] > (2, 5): (28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99)), 'Incorrect encoding' + class UniversalStringEncoderWithSchemaTestCase(BaseTestCase): + def testEncoding(self): + assert encoder.encode( + sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.UniversalString() + ) == ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99)), 'Incorrect encoding' + + class BMPStringEncoderTestCase(BaseTestCase): def testEncoding(self): assert encoder.encode(char.BMPString(sys.version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs( (30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding' +class BMPStringEncoderWithSchemaTestCase(BaseTestCase): + def testEncoding(self): + assert encoder.encode( + sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.BMPString() + ) == ints2octs((30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding' + + class UTF8StringEncoderTestCase(BaseTestCase): def testEncoding(self): assert encoder.encode(char.UTF8String(sys.version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs( (12, 3, 97, 98, 99)), 'Incorrect encoding' +class UTF8StringEncoderWithSchemaTestCase(BaseTestCase): + def testEncoding(self): + assert encoder.encode( + sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.UTF8String() + ) == ints2octs((12, 3, 97, 98, 99)), 'Incorrect encoding' + + class SequenceOfEncoderTestCase(BaseTestCase): def testEmpty(self): s = univ.SequenceOf() |