def testAccessors(self): """Test for KeyInfo accessors""" self.key_info.key_name.append( ds.key_name_from_string(ds_data.TEST_KEY_NAME)) self.key_info.key_value.append( ds.key_value_from_string(ds_data.TEST_KEY_VALUE1)) self.key_info.retrieval_method.append( ds.retrieval_method_from_string(ds_data.TEST_RETRIEVAL_METHOD)) self.key_info.x509_data.append( ds.x509_data_from_string(ds_data.TEST_X509_DATA)) self.key_info.pgp_data.append( ds.pgp_data_from_string(ds_data.TEST_PGP_DATA)) self.key_info.spki_data.append( ds.spki_data_from_string(ds_data.TEST_SPKI_DATA)) self.key_info.mgmt_data.append( ds.mgmt_data_from_string(ds_data.TEST_MGMT_DATA)) self.key_info.id = "id" new_key_info = ds.key_info_from_string(self.key_info.to_string()) assert isinstance(new_key_info.key_name[0], ds.KeyName) assert isinstance(new_key_info.key_value[0], ds.KeyValue) assert isinstance(new_key_info.retrieval_method[0], ds.RetrievalMethod) assert isinstance(new_key_info.x509_data[0], ds.X509Data) assert isinstance(new_key_info.pgp_data[0], ds.PGPData) assert isinstance(new_key_info.spki_data[0], ds.SPKIData) assert isinstance(new_key_info.mgmt_data[0], ds.MgmtData) assert new_key_info.id == "id"
def testAccessors(self): """Test for X509Data accessors""" st = ds.x509_issuer_serial_from_string(ds_data.TEST_X509_ISSUER_SERIAL) print(st) self.x509_data.x509_issuer_serial= st self.x509_data.x509_ski = ds.X509SKI(text="x509 ski") self.x509_data.x509_subject_name = ds.X509SubjectName( text="x509 subject name") self.x509_data.x509_certificate = ds.X509Certificate( text="x509 certificate") self.x509_data.x509_crl = ds.X509CRL(text="x509 crl") new_x509_data = ds.x509_data_from_string(self.x509_data.to_string()) print(new_x509_data.keyswv()) print(new_x509_data.__dict__.keys()) assert new_x509_data.x509_issuer_serial assert isinstance(new_x509_data.x509_issuer_serial, ds.X509IssuerSerial) assert new_x509_data.x509_ski.text.strip() == "x509 ski" assert isinstance(new_x509_data.x509_ski, ds.X509SKI) assert new_x509_data.x509_subject_name.text.strip() == \ "x509 subject name" assert isinstance(new_x509_data.x509_subject_name, ds.X509SubjectName) assert new_x509_data.x509_certificate.text.strip() == \ "x509 certificate" assert isinstance(new_x509_data.x509_certificate, ds.X509Certificate) assert new_x509_data.x509_crl.text.strip() == "x509 crl" assert isinstance(new_x509_data.x509_crl,ds.X509CRL)
def testUsingTestData(self): """Test for x509_data_from_string() using test data""" new_x509_data = ds.x509_data_from_string(ds_data.TEST_X509_DATA) assert isinstance(new_x509_data.x509_issuer_serial, ds.X509IssuerSerial) assert new_x509_data.x509_ski.text.strip() == "x509 ski" assert isinstance(new_x509_data.x509_ski, ds.X509SKI) assert new_x509_data.x509_subject_name.text.strip() == "x509 subject name" assert isinstance(new_x509_data.x509_subject_name, ds.X509SubjectName) assert new_x509_data.x509_certificate.text.strip() == "x509 certificate" assert isinstance(new_x509_data.x509_certificate, ds.X509Certificate) assert new_x509_data.x509_crl.text.strip() == "x509 crl" assert isinstance(new_x509_data.x509_crl, ds.X509CRL)
def testUsingTestData(self): """Test for x509_data_from_string() using test data""" new_x509_data = ds.x509_data_from_string(ds_data.TEST_X509_DATA) assert isinstance(new_x509_data.x509_issuer_serial, ds.X509IssuerSerial) assert new_x509_data.x509_ski.text.strip() == "x509 ski" assert isinstance(new_x509_data.x509_ski, ds.X509SKI) assert new_x509_data.x509_subject_name.text.strip() == \ "x509 subject name" assert isinstance(new_x509_data.x509_subject_name, ds.X509SubjectName) assert new_x509_data.x509_certificate.text.strip() == \ "x509 certificate" assert isinstance(new_x509_data.x509_certificate, ds.X509Certificate) assert new_x509_data.x509_crl.text.strip() == "x509 crl" assert isinstance(new_x509_data.x509_crl,ds.X509CRL)
def testAccessors(self): """Test for KeyInfo accessors""" self.key_info.key_name.append(ds.key_name_from_string(ds_data.TEST_KEY_NAME)) self.key_info.key_value.append(ds.key_value_from_string(ds_data.TEST_KEY_VALUE1)) self.key_info.retrieval_method.append(ds.retrieval_method_from_string(ds_data.TEST_RETRIEVAL_METHOD)) self.key_info.x509_data.append(ds.x509_data_from_string(ds_data.TEST_X509_DATA)) self.key_info.pgp_data.append(ds.pgp_data_from_string(ds_data.TEST_PGP_DATA)) self.key_info.spki_data.append(ds.spki_data_from_string(ds_data.TEST_SPKI_DATA)) self.key_info.mgmt_data.append(ds.mgmt_data_from_string(ds_data.TEST_MGMT_DATA)) self.key_info.id = "id" new_key_info = ds.key_info_from_string(self.key_info.to_string()) assert isinstance(new_key_info.key_name[0], ds.KeyName) assert isinstance(new_key_info.key_value[0], ds.KeyValue) assert isinstance(new_key_info.retrieval_method[0], ds.RetrievalMethod) assert isinstance(new_key_info.x509_data[0], ds.X509Data) assert isinstance(new_key_info.pgp_data[0], ds.PGPData) assert isinstance(new_key_info.spki_data[0], ds.SPKIData) assert isinstance(new_key_info.mgmt_data[0], ds.MgmtData) assert new_key_info.id == "id"
def testAccessors(self): """Test for X509Data accessors""" st = ds.x509_issuer_serial_from_string(ds_data.TEST_X509_ISSUER_SERIAL) print(st) self.x509_data.x509_issuer_serial = st self.x509_data.x509_ski = ds.X509SKI(text="x509 ski") self.x509_data.x509_subject_name = ds.X509SubjectName(text="x509 subject name") self.x509_data.x509_certificate = ds.X509Certificate(text="x509 certificate") self.x509_data.x509_crl = ds.X509CRL(text="x509 crl") new_x509_data = ds.x509_data_from_string(self.x509_data.to_string()) print(new_x509_data.keyswv()) print(new_x509_data.__dict__.keys()) assert new_x509_data.x509_issuer_serial assert isinstance(new_x509_data.x509_issuer_serial, ds.X509IssuerSerial) assert new_x509_data.x509_ski.text.strip() == "x509 ski" assert isinstance(new_x509_data.x509_ski, ds.X509SKI) assert new_x509_data.x509_subject_name.text.strip() == "x509 subject name" assert isinstance(new_x509_data.x509_subject_name, ds.X509SubjectName) assert new_x509_data.x509_certificate.text.strip() == "x509 certificate" assert isinstance(new_x509_data.x509_certificate, ds.X509Certificate) assert new_x509_data.x509_crl.text.strip() == "x509 crl" assert isinstance(new_x509_data.x509_crl, ds.X509CRL)