def test_String(self): asn1ptr = m2.asn1_string_new() text = 'hello there' # In RFC2253 format: # #040B68656C6C6F207468657265 # h e l l o t h e r e m2.asn1_string_set(asn1ptr, text) a = ASN1.ASN1_String(asn1ptr, 1) assert a.as_text() == 'hello there', a.as_text() assert a.as_text(flags=m2.ASN1_STRFLGS_RFC2253) == '#040B68656C6C6F207468657265', a.as_text(flags=m2.ASN1_STRFLGS_RFC2253)
def test_String(self): asn1ptr = m2.asn1_string_new() text = 'hello there' # In RFC2253 format: # #040B68656C6C6F207468657265 # h e l l o t h e r e m2.asn1_string_set(asn1ptr, text) a = ASN1.ASN1_String(asn1ptr, 1) assert a.as_text() == 'hello there', a.as_text() assert a.as_text(flags=m2.ASN1_STRFLGS_RFC2253 ) == '#040B68656C6C6F207468657265', a.as_text( flags=m2.ASN1_STRFLGS_RFC2253) self.assertEqual(a.as_text(), str(a))
def test_String(self): asn1ptr = m2.asn1_string_new() # FIXME this is probably wrong ... asn1_string_set should have # Python string as its parameter. text = b'hello there' # In RFC2253 format: # #040B68656C6C6F207468657265 # h e l l o t h e r e m2.asn1_string_set(asn1ptr, text) a = ASN1.ASN1_String(asn1ptr, 1) self.assertEqual(a.as_text(), 'hello there', a.as_text()) self.assertEqual(a.as_text(flags=m2.ASN1_STRFLGS_RFC2253), '#040B68656C6C6F207468657265', a.as_text(flags=m2.ASN1_STRFLGS_RFC2253)) self.assertEqual(a.as_text(), str(a))